All of lore.kernel.org
 help / color / mirror / Atom feed
* device-mapper ./WHATS_NEW lib/.exported_symbol ...
@ 2008-04-20  0:11 agk
  0 siblings, 0 replies; 4+ messages in thread
From: agk @ 2008-04-20  0:11 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	device-mapper
Changes by:	agk@sourceware.org	2008-04-20 00:11:08

Modified files:
	.              : WHATS_NEW 
	lib            : .exported_symbols libdevmapper.h libdm-report.c 

Log message:
	Add field name prefix option to reporting functions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.228&r2=1.229
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/.exported_symbols.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.80&r2=1.81
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-report.c.diff?cvsroot=dm&r1=1.17&r2=1.18

--- device-mapper/WHATS_NEW	2008/04/19 15:50:17	1.228
+++ device-mapper/WHATS_NEW	2008/04/20 00:11:07	1.229
@@ -1,5 +1,6 @@
 Version 1.02.26 - 
 =================================
+  Add field name prefix option to reporting functions.
   Calculate string size within dm_pool_grow_object.
 
 Version 1.02.25 - 10th April 2008
--- device-mapper/lib/.exported_symbols	2007/11/27 20:57:05	1.32
+++ device-mapper/lib/.exported_symbols	2008/04/20 00:11:08	1.33
@@ -132,5 +132,6 @@
 dm_report_field_uint32
 dm_report_field_uint64
 dm_report_field_set_value
+dm_report_set_output_field_name_prefix
 dm_regex_create
 dm_regex_match
--- device-mapper/lib/libdevmapper.h	2008/04/19 15:50:18	1.80
+++ device-mapper/lib/libdevmapper.h	2008/04/20 00:11:08	1.81
@@ -735,10 +735,11 @@
 /*
  * dm_report_init output_flags
  */
-#define DM_REPORT_OUTPUT_MASK		0x000000FF
-#define DM_REPORT_OUTPUT_ALIGNED	0x00000001
-#define DM_REPORT_OUTPUT_BUFFERED	0x00000002
-#define DM_REPORT_OUTPUT_HEADINGS	0x00000004
+#define DM_REPORT_OUTPUT_MASK			0x000000FF
+#define DM_REPORT_OUTPUT_ALIGNED		0x00000001
+#define DM_REPORT_OUTPUT_BUFFERED		0x00000002
+#define DM_REPORT_OUTPUT_HEADINGS		0x00000004
+#define DM_REPORT_OUTPUT_FIELD_NAME_PREFIX	0x00000008
 
 struct dm_report *dm_report_init(uint32_t *report_types,
 				 const struct dm_report_object_type *types,
@@ -753,6 +754,12 @@
 void dm_report_free(struct dm_report *rh);
 
 /*
+ * Prefix added to each field name with DM_REPORT_OUTPUT_FIELD_NAME_PREFIX
+ */
+int dm_report_set_output_field_name_prefix(struct dm_report *rh,
+					   const char *report_prefix);
+
+/*
  * Report functions are provided for simple data types.
  * They take care of allocating copies of the data.
  */
--- device-mapper/lib/libdm-report.c	2008/04/19 15:50:18	1.17
+++ device-mapper/lib/libdm-report.c	2008/04/20 00:11:08	1.18
@@ -17,6 +17,8 @@
 #include "list.h"
 #include "log.h"
 
+#include <ctype.h>
+
 /*
  * Internal flags
  */
@@ -27,6 +29,7 @@
 	struct dm_pool *mem;
 
 	uint32_t report_types;
+	const char *output_field_name_prefix;
 	const char *field_prefix;
 	uint32_t flags;
 	const char *separator;
@@ -551,6 +554,31 @@
 	dm_free(rh);
 }
 
+static char *_toupperstr(char *str)
+{
+	char *u = str;
+
+	do
+		*u = toupper(*u);
+	while (*u++);
+
+	return str;
+}
+
+int dm_report_set_output_field_name_prefix(struct dm_report *rh, const char *output_field_name_prefix)
+{
+	char *prefix;
+
+	if (!(prefix = dm_pool_strdup(rh->mem, output_field_name_prefix))) {
+		log_error("dm_report_set_output_field_name_prefix: dm_pool_strdup failed");
+		return 0;
+	}
+
+	rh->output_field_name_prefix = _toupperstr(prefix);
+	
+	return 1;
+}
+
 /*
  * Create a row of data for an object
  */
@@ -771,6 +799,7 @@
 	struct row *row = NULL;
 	struct dm_report_field *field;
 	const char *repstr;
+	char *field_id;
 	char buf[4096];
 	int32_t width;
 	uint32_t align;
@@ -798,6 +827,30 @@
 			if (field->props->flags & FLD_HIDDEN)
 				continue;
 
+			if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) {
+				if (!(field_id = strdup(rh->fields[field->props->field_num].id))) {
+					log_error("dm_report: Failed to copy field name");
+					goto bad;
+				}
+
+				if (!dm_pool_grow_object(rh->mem, rh->output_field_name_prefix, 0)) {
+					log_error("dm_report: Unable to extend output line");
+					goto bad;
+				}
+
+				if (!dm_pool_grow_object(rh->mem, _toupperstr(field_id), 0)) {
+					log_error("dm_report: Unable to extend output line");
+					goto bad;
+				}
+
+				free(field_id);
+
+				if (!dm_pool_grow_object(rh->mem, "=\"", 2)) {
+					log_error("dm_report: Unable to extend output line");
+					goto bad;
+				}
+			}
+
 			repstr = field->report_string;
 			width = field->props->width;
 			if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) {
@@ -832,6 +885,12 @@
 				}
 			}
 
+			if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX)
+				if (!dm_pool_grow_object(rh->mem, "\"", 1)) {
+					log_error("dm_report: Unable to extend output line");
+					goto bad;
+				}
+				
 			if (!list_end(&row->fields, fh))
 				if (!dm_pool_grow_object(rh->mem, rh->separator, 0)) {
 					log_error("dm_report: Unable to extend output line");

^ permalink raw reply	[flat|nested] 4+ messages in thread
* device-mapper ./WHATS_NEW lib/.exported_symbol ...
@ 2007-07-28 10:48 meyering
  0 siblings, 0 replies; 4+ messages in thread
From: meyering @ 2007-07-28 10:48 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	device-mapper
Changes by:	meyering@sourceware.org	2007-07-28 10:48:37

Modified files:
	.              : WHATS_NEW 
	lib            : .exported_symbols libdevmapper.h libdm-file.c 
	lib/ioctl      : libdm-iface.c 

Log message:
	Export dm_create_dir (was create_dir) to help fix LVM2 link error
	* lib/libdm-file.c (dm_create_dir): Rename from create_dir.
	* lib/libdevmapper.h (dm_create_dir): Declare.
	* lib/.exported_symbols: Add dm_create_dir.
	* lib/ioctl/libdm-iface.c (_create_control): Update sole use.
	Patch by Jun'ichi Nomura.  Details in
	http://www.redhat.com/archives/lvm-devel/2007-July/msg00040.html

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.195&r2=1.196
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/.exported_symbols.diff?cvsroot=dm&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdevmapper.h.diff?cvsroot=dm&r1=1.71&r2=1.72
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-file.c.diff?cvsroot=dm&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/ioctl/libdm-iface.c.diff?cvsroot=dm&r1=1.44&r2=1.45

--- device-mapper/WHATS_NEW	2007/07/28 10:27:34	1.195
+++ device-mapper/WHATS_NEW	2007/07/28 10:48:36	1.196
@@ -1,5 +1,6 @@
 Version 1.02.22 - 
 ================================
+  Export dm_create_dir (was create_dir) to help fix LVM2 link error
   Don't log mkdir fail-with-EROFS, to make create_dir equiv to the one in LVM2
   Introduce and use log_sys_* macros from LVM2
   dm_fclose: new function
--- device-mapper/lib/.exported_symbols	2007/07/24 14:15:45	1.30
+++ device-mapper/lib/.exported_symbols	2007/07/28 10:48:36	1.31
@@ -1,6 +1,7 @@
 dm_lib_release
 dm_lib_exit
 dm_driver_version
+dm_create_dir
 dm_fclose
 dm_get_library_version
 dm_log
--- device-mapper/lib/libdevmapper.h	2007/07/24 14:15:45	1.71
+++ device-mapper/lib/libdevmapper.h	2007/07/28 10:48:36	1.72
@@ -629,6 +629,12 @@
  **************************/
 
 /*
+ * Create a directory (with parent directories if necessary).
+ * Returns 1 on success, 0 on failure.
+ */
+int dm_create_dir(const char *dir);
+
+/*
  * Close a stream, with nicer error checking than fclose's.
  * Derived from gnulib's close-stream.c.
  *
--- device-mapper/lib/libdm-file.c	2007/07/28 10:27:34	1.7
+++ device-mapper/lib/libdm-file.c	2007/07/28 10:48:36	1.8
@@ -55,7 +55,7 @@
 	return r;
 }
 
-int create_dir(const char *dir)
+int dm_create_dir(const char *dir)
 {
 	struct stat info;
 
--- device-mapper/lib/ioctl/libdm-iface.c	2007/07/28 10:23:02	1.44
+++ device-mapper/lib/ioctl/libdm-iface.c	2007/07/28 10:48:36	1.45
@@ -225,7 +225,7 @@
 		return 0;
 
 	old_umask = umask(0022);
-	ret = create_dir(dm_dir());
+	ret = dm_create_dir(dm_dir());
 	umask(old_umask);
 
 	if (!ret)

^ permalink raw reply	[flat|nested] 4+ messages in thread
* device-mapper ./WHATS_NEW lib/.exported_symbol ...
@ 2007-07-24 14:15 meyering
  0 siblings, 0 replies; 4+ messages in thread
From: meyering @ 2007-07-24 14:15 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	device-mapper
Changes by:	meyering@sourceware.org	2007-07-24 14:15:45

Modified files:
	.              : WHATS_NEW 
	lib            : .exported_symbols libdevmapper.h libdm-file.c 

Log message:
	dm_fclose: new function
	* lib/libdevmapper.h: Declare it.
	* lib/libdm-file.c (dm_fclose): Define it.
	* lib/.exported_symbols: Add dm_fclose.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/.exported_symbols.diff?cvsroot=dm&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdevmapper.h.diff?cvsroot=dm&r1=1.70&r2=1.71
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-file.c.diff?cvsroot=dm&r1=1.4&r2=1.5

--- device-mapper/WHATS_NEW	2007/07/13 16:10:24	1.191
+++ device-mapper/WHATS_NEW	2007/07/24 14:15:45	1.192
@@ -1,5 +1,6 @@
 Version 1.02.22 - 
 ================================
+  dm_fclose: new function
 
 Version 1.02.21 - 13th July 2007
 ================================
--- device-mapper/lib/.exported_symbols	2007/04/27 18:40:23	1.29
+++ device-mapper/lib/.exported_symbols	2007/07/24 14:15:45	1.30
@@ -1,6 +1,7 @@
 dm_lib_release
 dm_lib_exit
 dm_driver_version
+dm_fclose
 dm_get_library_version
 dm_log
 dm_log_init
--- device-mapper/lib/libdevmapper.h	2007/04/27 18:40:23	1.70
+++ device-mapper/lib/libdevmapper.h	2007/07/24 14:15:45	1.71
@@ -27,6 +27,7 @@
 #include <limits.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>
 
 /*****************************************************************
  * The first section of this file provides direct access to the 
@@ -623,6 +624,21 @@
  */
 char *dm_basename(const char *path);
 
+/**************************
+ * file/stream manipulation
+ **************************/
+
+/*
+ * Close a stream, with nicer error checking than fclose's.
+ * Derived from gnulib's close-stream.c.
+ *
+ * Close "stream".  Return 0 if successful, and EOF (setting errno)
+ * otherwise.  Upon failure, set errno to 0 if the error number
+ * cannot be determined.  Useful mainly for writable streams.
+ */
+int dm_fclose(FILE *stream);
+
+
 /*
  * Returns size of a buffer which is allocated with dm_malloc.
  * Pointer to the buffer is stored in *buf.
--- device-mapper/lib/libdm-file.c	2006/05/10 16:23:41	1.4
+++ device-mapper/lib/libdm-file.c	2007/07/24 14:15:45	1.5
@@ -72,3 +72,16 @@
 	return 0;
 }
 
+int dm_fclose(FILE *stream)
+{
+	int prev_fail = ferror(stream);
+	int fclose_fail = fclose(stream);
+
+	/* If there was a previous failure, but fclose succeeded,
+	   clear errno, since ferror does not set it, and its value
+	   may be unrelated to the ferror-reported failure.  */
+	if (prev_fail && !fclose_fail)
+		errno = 0;
+
+	return prev_fail || fclose_fail ? EOF : 0;
+}

^ permalink raw reply	[flat|nested] 4+ messages in thread
* device-mapper ./WHATS_NEW lib/.exported_symbol ...
@ 2007-01-09 19:44 agk
  0 siblings, 0 replies; 4+ messages in thread
From: agk @ 2007-01-09 19:44 UTC (permalink / raw)
  To: dm-cvs, dm-devel

CVSROOT:	/cvs/dm
Module name:	device-mapper
Changes by:	agk@sourceware.org	2007-01-09 19:44:07

Modified files:
	.              : WHATS_NEW 
	lib            : .exported_symbols libdevmapper.h 
	                 libdm-deptree.c 

Log message:
	Add dm_tree_use_no_flush_suspend().

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.139&r2=1.140
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/.exported_symbols.diff?cvsroot=dm&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdevmapper.h.diff?cvsroot=dm&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-deptree.c.diff?cvsroot=dm&r1=1.29&r2=1.30

--- device-mapper/WHATS_NEW	2007/01/08 15:18:52	1.139
+++ device-mapper/WHATS_NEW	2007/01/09 19:44:07	1.140
@@ -1,5 +1,6 @@
 Version 1.02.14 - 
 =============================
+  Add dm_tree_use_no_flush_suspend().
   Lots of dmevent changes.
   Export dm_basename().
   Cope with a trailing space when comparing tables prior to possible reload.
--- device-mapper/lib/.exported_symbols	2007/01/08 15:18:52	1.24
+++ device-mapper/lib/.exported_symbols	2007/01/09 19:44:07	1.25
@@ -66,6 +66,7 @@
 dm_tree_node_add_mirror_target_log
 dm_tree_node_add_target_area
 dm_tree_skip_lockfs
+dm_tree_use_no_flush_suspend
 dm_is_dm_major
 dm_mknodes
 dm_malloc_aux
--- device-mapper/lib/libdevmapper.h	2007/01/08 15:18:52	1.60
+++ device-mapper/lib/libdevmapper.h	2007/01/09 19:44:07	1.61
@@ -316,6 +316,16 @@
 void dm_tree_skip_lockfs(struct dm_tree_node *dnode);
 
 /*
+ * Set the 'noflush' flag when suspending devices.
+ * If the kernel supports it, instead of erroring outstanding I/O that
+ * cannot be completed, the I/O is queued and resubmitted when the
+ * device is resumed.  This affects multipath devices when all paths
+ * have failed and queue_if_no_path is set, and mirror devices when
+ * block_on_error is set and the mirror log has failed.
+ */
+void dm_tree_use_no_flush_suspend(struct dm_tree_node *dnode);
+
+/*
  * Is the uuid prefix present in the tree?
  * Only returns 0 if every node was checked successfully.
  * Returns 1 if the tree walk has to be aborted.
--- device-mapper/lib/libdm-deptree.c	2006/10/13 14:03:35	1.29
+++ device-mapper/lib/libdm-deptree.c	2007/01/09 19:44:07	1.30
@@ -130,6 +130,7 @@
 	struct dm_hash_table *uuids;
 	struct dm_tree_node root;
 	int skip_lockfs;		/* 1 skips lockfs (for non-snapshots) */
+	int no_flush;		/* 1 sets noflush (mirrors/multipath) */
 };
 
 /* FIXME Consider exporting this */
@@ -162,6 +163,7 @@
 	list_init(&dtree->root.uses);
 	list_init(&dtree->root.used_by);
 	dtree->skip_lockfs = 0;
+	dtree->no_flush = 0;
 
 	if (!(dtree->mem = dm_pool_create("dtree", 1024))) {
 		log_error("dtree pool creation failed");
@@ -903,13 +905,15 @@
 }
 
 static int _suspend_node(const char *name, uint32_t major, uint32_t minor,
-			 int skip_lockfs, struct dm_info *newinfo)
+			 int skip_lockfs, int no_flush, struct dm_info *newinfo)
 {
 	struct dm_task *dmt;
 	int r;
 
-	log_verbose("Suspending %s (%" PRIu32 ":%" PRIu32 ")%s", name, major,
-		    minor, skip_lockfs ? "" : " with filesystem sync.");
+	log_verbose("Suspending %s (%" PRIu32 ":%" PRIu32 ")%s%s",
+		    name, major, minor,
+		    skip_lockfs ? "" : " with filesystem sync",
+		    no_flush ? "" : " without device flush");
 
 	if (!(dmt = dm_task_create(DM_DEVICE_SUSPEND))) {
 		log_error("Suspend dm_task creation failed for %s", name);
@@ -928,6 +932,9 @@
 	if (skip_lockfs && !dm_task_skip_lockfs(dmt))
 		log_error("Failed to set skip_lockfs flag.");
 
+	if (no_flush && !dm_task_no_flush(dmt))
+		log_error("Failed to set no_flush flag.");
+
 	if ((r = dm_task_run(dmt)))
 		r = dm_task_get_info(dmt, newinfo);
 
@@ -991,6 +998,11 @@
 	dnode->dtree->skip_lockfs = 1;
 }
 
+void dm_tree_use_no_flush_suspend(struct dm_tree_node *dnode)
+{
+	dnode->dtree->no_flush = 1;
+}
+
 int dm_tree_suspend_children(struct dm_tree_node *dnode,
 				   const char *uuid_prefix,
 				   size_t uuid_prefix_len)
@@ -1032,7 +1044,8 @@
 			continue;
 
 		if (!_suspend_node(name, info.major, info.minor,
-				   child->dtree->skip_lockfs, &newinfo)) {
+				   child->dtree->skip_lockfs,
+				   child->dtree->no_flush, &newinfo)) {
 			log_error("Unable to suspend %s (%" PRIu32
 				  ":%" PRIu32 ")", name, info.major,
 				  info.minor);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-20  0:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-20  0:11 device-mapper ./WHATS_NEW lib/.exported_symbol agk
  -- strict thread matches above, loose matches on Subject: below --
2007-07-28 10:48 meyering
2007-07-24 14:15 meyering
2007-01-09 19:44 agk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.