Skip to contentSkip to conversation

master - lib/properties: Common code for handling properties.

PATCH tasleson 1 participant 1 message Jul 12, 2013 Library code

lore
Share & tools
lore

tasleson

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9775a19af1f2a93d5550f4ff5843e3ac8e556eb1
Commit:        9775a19af1f2a93d5550f4ff5843e3ac8e556eb1
Parent:        bdd2246ce91d8b8c050ad7a2b52e32489262c4b3
Author:        Tony Asleson <[email protected]>
AuthorDate:    Fri Jul 12 13:09:44 2013 -0400
Committer:     Tony Asleson <[email protected]>
CommitterDate: Fri Jul 12 16:52:16 2013 -0500

lib/properties: Common code for handling properties.

The common bits from lib/report/properties.[c|h] have been moved to lib/properties/prop_common.[c|h] to allow re-use of property handling functionality without polluting the report handling functionality.

---
 include/.symlinks.in         |    1 +
 lib/Makefile.in              |    3 +-
 lib/properties/prop_common.c |   92 ++++++++++++
 lib/properties/prop_common.h |  121 +++++++++++++++
 lib/report/columns.h         |   43 +------
 lib/report/properties.c      |  331 ++++++++++++++----------------------------
 lib/report/properties.h      |   17 +--
 7 files changed, 329 insertions(+), 279 deletions(-)
include/.symlinks.in +1 -0
index 7fdc045..0fdcdb0 100644
@@ -58,6 +58,7 @@
 @top_srcdir@/lib/misc/lvm-wrappers.h
 @top_srcdir@/lib/misc/lvm-percent.h
 @top_srcdir@/lib/misc/sharedlib.h
+ at top_srcdir@/lib/properties/prop_common.h
 @top_srcdir@/lib/report/properties.h
 @top_srcdir@/lib/report/report.h
 @top_srcdir@/lib/uuid/uuid.h
lib/Makefile.in +2 -1
index d789839..a58605c 100644
@@ -1,6 +1,6 @@
 #
 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
-# Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
 #
 # This file is part of LVM2.
 #
@@ -104,6 +104,7 @@ SOURCES =\
 	misc/lvm-wrappers.c \
 	misc/lvm-percent.c \
 	mm/memlock.c \
+	properties/prop_common.c \
 	report/properties.c \
 	report/report.c \
 	striped/striped.c \
lib/properties/prop_common.c new file +92 -0

92 lines not on this page · raw message

lib/properties/prop_common.h new file +121 -0

121 lines not on this page · raw message

lib/report/columns.h +1 -42

54 lines not on this page · raw message

lib/report/properties.c +110 -221

524 lines not on this page · raw message

lib/report/properties.h +2 -15
index aefd3f5..4e8bf86 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010-2013 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -18,20 +18,7 @@
 #include "lvm-types.h"
 #include "metadata.h"
 #include "report.h"
-
-struct lvm_property_type {
-	unsigned type;
-	const char *id;
-	unsigned is_settable:1;
-	unsigned is_string:1;
-	unsigned is_integer:1;
-	union {
-		const char *string;
-		uint64_t integer;
-	} value;
-	int (*get) (const void *obj, struct lvm_property_type *prop);
-	int (*set) (void *obj, struct lvm_property_type *prop);
-};
+#include "prop_common.h"
 
 int lvseg_get_property(const struct lv_segment *lvseg,
 		       struct lvm_property_type *prop);