Skip to contentSkip to conversation

device-mapper ./WHATS_NEW include/log.h lib/.e ...

PATCH [email protected] 1 participant 1 message Apr 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: device-mapper
Changes by: [email protected] 2007-04-27 19:40:23

Modified files:

	.              : WHATS_NEW 
	include        : log.h 
	lib            : .exported_symbols Makefile.in libdevmapper.h 

Added files:
lib/regex : matcher.c parse_rx.c parse_rx.h ttree.c ttree.h

Log message:
Add regex functions to library.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.179&r2=1.180
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/include/log.h.diff?cvsroot=dm&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/.exported_symbols.diff?cvsroot=dm&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/Makefile.in.diff?cvsroot=dm&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdevmapper.h.diff?cvsroot=dm&r1=1.69&r2=1.70
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/regex/matcher.c.diff?cvsroot=dm&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/regex/parse_rx.c.diff?cvsroot=dm&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/regex/parse_rx.h.diff?cvsroot=dm&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/regex/ttree.c.diff?cvsroot=dm&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/regex/ttree.h.diff?cvsroot=dm&r1=NONE&r2=1.1

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 1.02.19 -
 ====================================
+  Add regex functions to library.
   Avoid trailing separator in reports when there are hidden sort fields.
   Fix segfault in 'dmsetup status' without --showkeys against crypt target.
   Deal with some more compiler warnings.
include/log.h +1 -0
@@ -40,5 +40,6 @@
 #define return_0	do { stack; return 0; } while (0)
 #define return_NULL	do { stack; return NULL; } while (0)
 #define goto_out	do { stack; goto out; } while (0)
+#define goto_bad	do { stack; goto bad; } while (0)
 
 #endif
lib/.exported_symbols +2 -0
@@ -127,3 +127,5 @@
 dm_report_field_uint32
 dm_report_field_uint64
 dm_report_field_set_value
+dm_regex_create
+dm_regex_match
lib/Makefile.in +3 -0
@@ -27,6 +27,9 @@
 	libdm-report.c \
 	mm/dbg_malloc.c \
 	mm/pool.c \
+	regex/matcher.c \
+	regex/parse_rx.c \
+	regex/ttree.c \
 	$(interface)/libdm-iface.c
 
 INCLUDES = -I$(interface)
lib/libdevmapper.h +19 -0
@@ -631,6 +631,25 @@
 int dm_asprintf(char **buf, const char *format, ...);
 
 /*********************
+ * regular expressions
+ *********************/
+struct dm_regex;
+
+/*
+ * Initialise an array of num patterns for matching.
+ * Uses memory from mem.
+ */
+struct dm_regex *dm_regex_create(struct dm_pool *mem, const char **patterns,
+				 unsigned num_patterns);
+
+/*
+ * Match string s against the patterns.
+ * Returns the index of the highest pattern in the array that matches,
+ * or -1 if none match.
+ */
+int dm_regex_match(struct dm_regex *regex, const char *s);
+
+/*********************
  * reporting functions
  *********************/
 

/cvs/dm/device-mapper/lib/regex/matcher.c,v --> standard output revision 1.1

- renamed from lib/regex/matcher.c +358 -0

358 lines not on this page · raw message

/cvs/dm/device-mapper/lib/regex/parse_rx.c,v --> standard output revision 1.1

- renamed from lib/regex/parse_rx.c +360 -0

360 lines not on this page · raw message

/cvs/dm/device-mapper/lib/regex/parse_rx.h,v --> standard output revision 1.1

- renamed from lib/regex/parse_rx.h +52 -0

52 lines not on this page · raw message

/cvs/dm/device-mapper/lib/regex/ttree.c,v --> standard output revision 1.1

- renamed from lib/regex/ttree.c +117 -0

117 lines not on this page · raw message

/cvs/dm/device-mapper/lib/regex/ttree.h,v --> standard output revision 1.1

- renamed from lib/regex/ttree.h +26 -0
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
+ * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of the device-mapper userspace tools.
+ *
+ * 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 _DM_TTREE_H
+#define _DM_TTREE_H
+
+struct ttree;
+
+struct ttree *ttree_create(struct dm_pool *mem, unsigned int klen);
+
+void *ttree_lookup(struct ttree *tt, unsigned *key);
+int ttree_insert(struct ttree *tt, unsigned *key, void *data);
+
+#endif