Skip to contentSkip to conversation

dmraid ./CHANGELOG ./KNOWN_BUGS ./README ./dmr ...

PATCH [email protected] 1 participant 1 message Apr 2, 2008

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

CVSROOT: /cvs/dm
Module name: dmraid
Changes by: [email protected] 2008-04-02 13:35:32

Modified files:
. : CHANGELOG KNOWN_BUGS README dmraid.spec
include/dmraid : lib_context.h
lib : internal.h version.h
lib/activate : activate.c devmapper.c
lib/format : format.c
lib/format/ataraid: asr.c isw.c jm.c lsi.c lsi.h nv.c pdc.c
pdc.h
lib/format/ddf : ddf1.c ddf1_crc.c lib/format/partition: dos.c
lib/metadata : metadata.c
lib/misc : lib_context.c
man : dmraid.8
tools : VERSION commands.c commands.h

Log message:

	1.0.0.rc15-pre checkin

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/CHANGELOG.diff?cvsroot=dm&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/KNOWN_BUGS.diff?cvsroot=dm&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/README.diff?cvsroot=dm&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/dmraid.spec.diff?cvsroot=dm&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/include/dmraid/lib_context.h.diff?cvsroot=dm&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/internal.h.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/version.h.diff?cvsroot=dm&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/activate/activate.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/activate/devmapper.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/format.c.diff?cvsroot=dm&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/asr.c.diff?cvsroot=dm&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/isw.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/jm.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/lsi.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/lsi.h.diff?cvsroot=dm&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/nv.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/pdc.c.diff?cvsroot=dm&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/pdc.h.diff?cvsroot=dm&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ddf/ddf1.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ddf/ddf1_crc.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/partition/dos.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/metadata/metadata.c.diff?cvsroot=dm&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/misc/lib_context.c.diff?cvsroot=dm&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/man/dmraid.8.diff?cvsroot=dm&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/tools/VERSION.diff?cvsroot=dm&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/tools/commands.c.diff?cvsroot=dm&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/tools/commands.h.diff?cvsroot=dm&r1=1.1&r2=1.2

CHANGELOG +17 -0
@@ -1,4 +1,21 @@
 
+Changelog from dmraid 1.0.0.rc14 to 1.0.0.rc15		2007.08.22
+
+FIXES:
+------
+o jm.c: fixed name handling, when whitespace added to end of name
+o nv.c: fixed endian bug (Bryn Reeves)
+
+
+FEATURES:
+---------
+
+
+MISCELANIOUS:
+-------------
+
+
+
 Changelog from dmraid 1.0.0.rc13 to 1.0.0.rc14		2006.11.08
 
 FIXES:
KNOWN_BUGS +1 -1
@@ -1,4 +1,4 @@
 
-KNOWN_BUGS in dmraid 1.0.0.rc14					2005.11.08
+KNOWN_BUGS in dmraid 1.0.0.rc15					2008.04.02
 
 o "dmraid --sets[a/i]" doesn't work properly. Use the short option -s.
README +4 -4
@@ -1,8 +1,8 @@
 ********************************************************************************
 *                                                                              *
-*   dmraid (Device-Mapper Software RAID support tool) 1.0.0.rc14  2006.11.08   *
+*   dmraid (Device-Mapper Software RAID tool) 1.0.0.rc15-pre 2008.04.02        *
 *                                                                              *
-*   (C)opyright 2004-2006  Heinz Mauelshagen, Red Hat GmbH.                    *
+*   (C)opyright 2004-2008  Heinz Mauelshagen, Red Hat GmbH.                    *
 *   All rights reserved.                                                       *
 *                                                                              *
 ********************************************************************************
@@ -66,13 +66,13 @@
 --------------
 To install the rpm
 
-rpm -i [--nodeps] dmraid-1.0.0.rc10.i386.rpm
+rpm -i [--nodeps] dmraid-1.0.0.rc15.i386.rpm
 
 - or -
 
 to build in an empty directory and install from source
 
-tar jxvf dmraid-1.0.0.rc10.tar.bz2
+tar jxvf dmraid-1.0.0.rc15.tar.bz2
 ./configure	# see ./configure --help for options
 make
 make install
dmraid.spec +1 -1
@@ -6,7 +6,7 @@
 
 Summary: dmraid (Device-mapper RAID tool and library)
 Name: dmraid
-Version: 1.0.0.rc11
+Version: 1.0.0.rc15-pre
 Release: 1
 License: GPL
 Group: System Environment/Base
include/dmraid/lib_context.h +4 -1
@@ -38,7 +38,8 @@
 	LC_VERBOSE,
 	LC_IGNORELOCKING,
 	LC_SEPARATOR,
-	LC_DEVICES,	  /* Add new options below this one ! */
+	LC_DEVICES,
+	LC_PARTCHAR,	  /* Add new options below this one ! */
 	LC_OPTIONS_SIZE,  /* Must be the last enumerator. */
 };
 
@@ -55,12 +56,14 @@
 #define	OPT_SETS(lc)		(lc_opt(lc, LC_SETS))
 #define	OPT_TEST(lc)		(lc_opt(lc, LC_TEST))
 #define	OPT_VERBOSE(lc)		(lc_opt(lc, LC_VERBOSE))
+#define	OPT_PARTCHAR(lc)	(lc_opt(lc, LC_PARTCHAR))
 
 /* Return option value. */
 #define	OPT_STR(lc, o)		(lc->options[o].arg.str)
 #define	OPT_STR_COLUMN(lc)	OPT_STR(lc, LC_COLUMN)
 #define	OPT_STR_FORMAT(lc)	OPT_STR(lc, LC_FORMAT)
 #define	OPT_STR_SEPARATOR(lc)	OPT_STR(lc, LC_SEPARATOR)
+#define	OPT_STR_PARTCHAR(lc)	OPT_STR(lc, LC_PARTCHAR)
 
 struct lib_version {
 	const char *text;
lib/internal.h +2 -2
@@ -49,8 +49,8 @@
 #define	u_int64_t	uint64_t
 #endif
 
-#define min(a, b) a < b ? a : b
-#define max(a, b) a > b ? a : b
+#define min(a, b) (a) < (b) ? (a) : (b)
+#define max(a, b) (a) > (b) ? (a) : (b)
 #define ARRAY_SIZE(a)   (sizeof(a) / sizeof(*a))
 #define ARRAY_END(a)   (a + ARRAY_SIZE(a))
 
lib/version.h +3 -3
@@ -1,12 +1,12 @@
 #ifndef	DMRAID_LIB_VERSION
 
-#define	DMRAID_LIB_VERSION		"1.0.0.rc14"
+#define	DMRAID_LIB_VERSION		"1.0.0.rc15"
 
 #define	DMRAID_LIB_MAJOR_VERSION	1
 #define	DMRAID_LIB_MINOR_VERSION	0
 #define	DMRAID_LIB_SUBMINOR_VERSION	0
-#define	DMRAID_LIB_VERSION_SUFFIX	"rc14"
+#define	DMRAID_LIB_VERSION_SUFFIX	"rc15"
 
-#define	DMRAID_LIB_DATE			"(2006.11.08)"
+#define	DMRAID_LIB_DATE			"(2008.04.02)"
 
 #endif
lib/activate/activate.c +5 -1
@@ -398,7 +398,11 @@
 			goto err;
 	}
 
-	return 1;
+	/* Append the flag/feature required for dmraid1 
+	 * event handling in the kernel driver 
+	 */
+	if(p_fmt(lc, table, " 1 handle_errors"))
+		return 1;
 
    err:
 	return log_alloc_err(lc, __func__);
lib/activate/devmapper.c +29 -3
@@ -21,6 +21,8 @@
 #include "internal.h"
 #include "devmapper.h"
 
+#include <linux/dm-ioctl.h>
+
 /* Make up a dm path. */
 char *mkdm_path(struct lib_context *lc, const char *name)
 {
@@ -147,24 +149,48 @@
 	return handle_table(lc, NULL, table, get_target_list());
 }
 
+/* Build a UUID for a dmraid device 
+ * Return 1 for sucess; 0 for failure*/
+static int dmraid_uuid(struct lib_context *lc, struct raid_set *rs,
+		       char *uuid, uint uuid_len) {
+	int r;
+
+	/* Clear garbage data from uuid string */
+	memset(uuid, 0, uuid_len);
+
+	/* Create UUID string from subsystem prefix and RAID set name. */
+	r = snprintf(uuid, uuid_len, "DMRAID-%s", rs->name) < uuid_len;
+	return r < 0 ? 0 : (r < uuid_len);
+}
+
 /* Create a task, set its name and run it. */
 static int run_task(struct lib_context *lc, struct raid_set *rs,
 		    char *table, int type)
 {
+	/* DM_UUID_LEN is defined in dm-ioctl.h as 129 characters;
+	 * though not all 129 must be used (md uses just 16 from 
+	 * a quick review of md.c. 
+	 * We will be using: (len vol grp name)*/ 
+	char uuid[DM_UUID_LEN];
 	int ret;
 	struct dm_task *dmt;
 
 	_init_dm();
-	ret = (dmt = dm_task_create(type)) && dm_task_set_name(dmt, rs->name);
+	ret = (dmt = dm_task_create(type)) &&
+	      dm_task_set_name(dmt, rs->name);
 	if (ret && table)
 		ret = parse_table(lc, dmt, table);
 
-	if (ret)
-		ret = dm_task_run(dmt);
+	if (ret && 
+	    DM_DEVICE_CREATE == type)
+		ret = dmraid_uuid(lc, rs, uuid, DM_UUID_LEN) &&
+		      dm_task_set_uuid(dmt, uuid) &&
+		      dm_task_run(dmt);
 
 	_exit_dm(dmt);
 	return ret;
 }
+	
 /* Create a mapped device. */
 int dm_create(struct lib_context *lc, struct raid_set *rs, char *table)
 {
lib/format/format.c +12 -12
@@ -18,7 +18,7 @@
  * Comment next line out to avoid pre-registration
  * checks on metadata format handlers.
  */
-// #define	CHECK_FORMAT_HANDLER
+#define	CHECK_FORMAT_HANDLER
 #ifdef	CHECK_FORMAT_HANDLER
 /*
  * Check that mandatory members of a metadata form handler are present.
@@ -34,25 +34,25 @@
 #define offset(member)	struct_offset(dmraid_format, member)
 
 struct format_member {
-	const unsigned short offset;
-	const unsigned char flags;
 	const char *msg;
+	const unsigned short offset;
+	const unsigned short flags;
 } __attribute__ ((packed));
 
 enum { FMT_ALL = 0x01, FMT_METHOD = 0x02 } format_flags;
 #define	IS_FMT_ALL(member)	(member->flags & FMT_ALL)
 #define	IS_FMT_METHOD(member)	(member->flags & FMT_METHOD)
 static struct format_member format_member[] = {
-	{ offset(name), FMT_ALL, "name" },
-	{ offset(descr), FMT_ALL, "description" },
-	{ offset(caps), 0, "capabilities" },
-	{ offset(read), FMT_ALL|FMT_METHOD, "read" },
-	{ offset(write), FMT_METHOD, "write" },
-	{ offset(group), FMT_ALL|FMT_METHOD, "group" },
-	{ offset(check), FMT_ALL|FMT_METHOD, "check" },
-	{ offset(events), 0, "events array" },
+	{ "name", offset(name), FMT_ALL },
+	{ "description", offset(descr), FMT_ALL },
+	{ "capabilities", offset(caps), 0 },
+	{ "read", offset(read), FMT_ALL|FMT_METHOD },
+	{ "write", offset(write), FMT_METHOD },
+	{ "group", offset(group), FMT_ALL|FMT_METHOD },
+	{ "check", offset(check), FMT_ALL|FMT_METHOD },
+	{ "events array", offset(events), 0 },
 #ifdef	NATIVE_LOG
-	{ offset(log),    FMT_METHOD, "log" },
+	{ "log", offset(log), FMT_METHOD },
 #endif
 };
 #undef	offset
lib/format/ataraid/asr.c +93 -82

373 lines not on this page · raw message

lib/format/ataraid/isw.c +15 -10
@@ -364,21 +364,26 @@
 {
 	int ret;
 	struct isw *isw = META(rd, isw);
+	int large = div_up(isw->mpb_size, ISW_DISK_BLOCK_SIZE) > 1;
 
 	to_disk(isw, FULL);
 
-	/*
-	 * Copy 1st metadata sector to after the extended ones
-	 * and increment metadata area pointer by one block, so
-	 * that the metadata is filed in the proper sequence.
-	 */
-	memcpy((void*) isw + rd->meta_areas->size, isw, ISW_DISK_BLOCK_SIZE);
-	rd->meta_areas->area += ISW_DISK_BLOCK_SIZE;
+	if (large) {
+		/*
+		 * Copy 1st metadata sector to after the extended ones
+		 * and increment metadata area pointer by one block, so
+		 * that the metadata is filed in the proper sequence.
+		 */
+		memcpy((void*) isw + rd->meta_areas->size, isw,
+		       ISW_DISK_BLOCK_SIZE);
+		rd->meta_areas->area += ISW_DISK_BLOCK_SIZE;
+	}
 
 	ret = write_metadata(lc, handler, rd, -1, erase);
 
 	/* Correct metadata area pointer. */
-	rd->meta_areas->area -= ISW_DISK_BLOCK_SIZE;
+	if (large)
+		rd->meta_areas->area -= ISW_DISK_BLOCK_SIZE;
 
 	to_cpu(isw, FULL);
 
@@ -504,7 +509,7 @@
 
 /* Add an Intel SW RAID device to a set */
 static struct raid_set *isw_group(struct lib_context *lc,
-				    struct raid_dev *rd_meta)
+				  struct raid_dev *rd_meta)
 {
 	struct raid_set *rs_group;
 
@@ -744,7 +749,7 @@
 static struct dmraid_format isw_format = {
 	.name	= HANDLER,
 	.descr	= "Intel Software RAID",
-	.caps	= "0,1",
+	.caps	= "0,1,5",
 	.format = FMT_RAID,
 	.read	= isw_read,
 	.write	= isw_write,
lib/format/ataraid/jm.c +13 -11
@@ -1,8 +1,8 @@
 /*
  * JMicron metadata format handler.
  *
- * Copyright (C) 2006  Heinz Mauelshagen, Red Hat GmbH.
- *                     All rights reserved.
+ * Copyright (C) 2006,2007  Heinz Mauelshagen, Red Hat GmbH.
+ *                          All rights reserved.
  *
  * See file LICENSE at the top of this source tree for license information.
  */
@@ -25,25 +25,27 @@
 static char *name(struct lib_context *lc, struct raid_dev *rd,
 		  unsigned int subset)
 {
+	int i;
 	size_t len;
 	struct jm *jm = META(rd, jm);
-	char buf[2], *ret, *name = (char *) jm->name;
+	char buf[JM_NAME_LEN + 1], *ret, *name = (char *) jm->name;
 
-	/* Name always 0 terminated ? */
-	if ((len = strlen(name)) > JM_NAME_LEN)
-		len = JM_NAME_LEN;
-
-	len += sizeof(HANDLER) + 2;
-	if (jm->mode == JM_T_RAID01)
-		len++;
+	/* Name always 0 terminated or whitespace at end ? */
+	strncpy(buf, name, JM_NAME_LEN);
+	len = strlen(buf);
+	i = len < JM_NAME_LEN ? len : JM_NAME_LEN;
+	buf[i] = 0;
+	while (i-- && isspace(buf[i]))
+		buf[i] = 0;
 
+	len = strlen(buf) + sizeof(HANDLER) + (jm->mode == JM_T_RAID01 ? 3 : 2);
 	if ((ret = dbg_malloc(len))) {
 		if (jm->mode == JM_T_RAID01 && subset)
 			sprintf(buf, "-%u", member(jm) / 2);
 		else
 			*buf = 0;
 
-		sprintf(ret, "%s_%s%s", HANDLER, name, buf);
+		sprintf(ret, "%s_%s%s", handler, name, buf);
 	}
 
 	return ret;
lib/format/ataraid/lsi.c +6 -2
@@ -179,6 +179,10 @@
 {
 	struct lsi *lsi = META(rd, lsi);
 
+	/* Refuse to add drives that are not online */
+	if (get_disk(lsi)->offline)
+		return 0;
+
 	if (!init_raid_set(lc, rs, rd, lsi->stride, type(lsi), handler))
 		return 0;
 
@@ -300,8 +304,8 @@
 		  i, disk->disk_number);
 		P("disks[%u].set_number: %u", lsi, disk->set_number,
 		  i, disk->set_number);
-		P("disks[%u].unknown1: %u, 0x%u", lsi, disk->unknown1,
-		  i, disk->unknown1, disk->unknown1);
+		P("disks[%u].unknown1: %lu, 0x%lX", lsi, disk->unknown1,
+		  i, (uint64_t) disk->unknown1, (uint64_t) disk->unknown1);
 	}
 
 	DP("disk_number: %u", lsi, lsi->disk_number);
lib/format/ataraid/lsi.h +4 -1
@@ -28,7 +28,8 @@
 	uint16_t magic_1;
 	uint8_t disk_number;
 	uint8_t set_number;
-	uint8_t unknown1[8];
+	uint8_t offline;
+	uint8_t unknown1[7];
 } __attribute__ ((packed));
 
 struct lsi {
@@ -47,8 +48,10 @@
 	uint8_t dummy4;		/* 0x11 */
 	uint16_t stride;		/* 0x12 - 0x13 */
 	uint8_t filler[0x20-0x14];	/* 0x14 - 0x1F */
+
 #define	LSI_MAX_DISKS	4
 	struct lsi_disk disks[LSI_MAX_DISKS];/* 0x20 - 0x5F */
+
 #define	LSI_DISK(lsi)		(lsi->set_number * 2 + lsi->disk_number)
 #define LSI_MAGIC_0(lsi)	(lsi->disks[LSI_DISK(lsi)].magic_0)
 #define LSI_MAGIC_1(lsi)	(lsi->disks[LSI_DISK(lsi)].magic_1)
lib/format/ataraid/nv.c +1 -1
@@ -155,7 +155,7 @@
 	CVT32(nv->unitFlags);
 	CVT32(array->version);
 
-	while (i--);
+	while (i--)
 		CVT32(array->signature[i]);
 
 	CVT32(array->raidLevel);
lib/format/ataraid/pdc.c +229 -66

442 lines not on this page · raw message

lib/format/ataraid/pdc.h +10 -2
@@ -13,9 +13,16 @@
 
 #include <stdint.h>
 
-#define PDC_CONFIGOFFSETS	63,255,256,16,399,735
+#define PDC_CONFIGOFFSETS	63,255,256,16,399,675,735,974,991
 #define	PDC_DATAOFFSET 0
 
+/*
+ * Maximum metadata areas checked for and offset of
+ * those relative to PDC_CONFIGOFFSETS value in sectors.
+ */
+#define	PDC_MAX_META_AREAS	4
+#define	PDC_META_OFFSET		14
+
 /* Ondisk metadata for Promise Fastrack */
 struct pdc {
 #define PDC_ID_LENGTH	24
@@ -36,7 +43,8 @@
 		uint8_t device;			/* 0x207 */
 		uint32_t magic_0;		/* 0x208 - 0x20B */
 		uint32_t unknown_1;		/* 0x20C - 0x20F */
-		uint32_t unknown_2;		/* 0x210 - 0x213 */
+		// uint32_t unknown_2;		/* 0x210 - 0x213 */
+		uint32_t start;			/* 0x210 - 0x213 */
 		uint32_t disk_secs;		/* 0x214 - 0x217 */
 		uint32_t unknown_3;		/* 0x218 - 0x21B */
 		uint16_t unknown_4;		/* 0x21C - 0x21D */
lib/format/ddf/ddf1.c +25 -9
@@ -19,6 +19,18 @@
 #include "ddf1_cvt.h"
 #include "ddf1_dump.h"
 
+#define GRP_RD(rd) \
+	(((struct ddf1_group_info *) (rd)->private.ptr)->rd_group)
+
+/*
+ * Helper struct to squirrel a group set reference to the check method
+ * in order to avoid, that premature deallocation in metadata.c
+ * removes the group set.
+ */
+struct ddf1_group_info {
+	struct raid_dev *rd_group;
+};
+
 static const char *handler = HANDLER;
 
 #define	DDF1_SPARES	".ddf1_spares"
@@ -595,8 +607,10 @@
 /* Sort DDF1 devices by offset entry within a RAID set. */
 static int dev_sort(struct list_head *pos, struct list_head *new)
 {
-	return compose_id(META(RD(new)->private.ptr, ddf1), RD(new)) <
-	       compose_id(META(RD(pos)->private.ptr, ddf1), RD(pos));
+	struct raid_dev *rd_pos = RD(pos), *rd_new = RD(new);
+
+	return compose_id(META(GRP_RD(rd_new), ddf1), rd_new) <
+	       compose_id(META(GRP_RD(rd_pos), ddf1), rd_pos);
 }
 
 /*
@@ -705,6 +719,7 @@
 	struct raid_dev *rd;
 	struct ddf1_config_record *cr;
 	struct ddf1_phys_drive *pd;
+	struct ddf1_group_info *gi;
 	unsigned int devs, i;
 	
 	if (!(pd = get_phys_drive(ddf1)))
@@ -746,8 +761,14 @@
 			return NULL;
 		}
 
+		if (!(gi = alloc_private(lc, handler, sizeof(*gi)))) {
+			free_raid_dev(lc, &rd);
+			return NULL;
+		}
+
 		/* Keep reference to the entire device for ddf1_check() */
-		rd->private.ptr = rd_group;
+		rd->private.ptr = gi;
+		GRP_RD(rd) = rd_group;
 
 		/* Add rest of subset state */
 		rs->stride = stride(cr);
@@ -825,13 +846,8 @@
 {
 	/* Get the logical drive */
 	struct ddf1_config_record *cr =
-		get_this_config(META(rd->private.ptr, ddf1), rd->offset);
+		get_this_config(META(GRP_RD(rd), ddf1), rd->offset);
 
-	/*
-	 * Release reference after check, so that core
-	 * doesn't try to free it multiple times.
-	 */
-	rd->private.ptr = NULL;
 	return cr ? cr->primary_element_count : 0;
 }
 
lib/format/ddf/ddf1_crc.c +1 -0
@@ -16,6 +16,7 @@
 #include "ddf1.h"
 #include "ddf1_crc.h"
 #include "ddf1_lib.h"
+#include "zlib.h"
 
 #define DM_BYTEORDER_SWAB
 #include <datastruct/byteorder.h>
lib/format/partition/dos.c +5 -2
@@ -29,8 +29,11 @@
 		    unsigned short partition, char *str, size_t len,
 		    unsigned char type)
 {
-	return snprintf(str, len, type ? "%s%u" : "%s",
-			get_basename(lc, rd->di->path), partition);
+	const char *base = get_basename(lc, rd->di->path);
+
+	return type ? snprintf(str, len, "%s%s%u", base, OPT_STR_PARTCHAR(lc),
+			       partition) :
+		      snprintf(str, len, "%s", base);
 }
 
 static char *name(struct lib_context *lc, struct raid_dev *rd,
lib/metadata/metadata.c +80 -18

165 lines not on this page · raw message

lib/misc/lib_context.c +3 -0
@@ -94,6 +94,9 @@
 {
 	lc_inc_opt(lc, LC_SEPARATOR);
 	lc->options[LC_SEPARATOR].arg.str = dbg_strdup((char*) ",");
+
+	lc_inc_opt(lc, LC_PARTCHAR);
+	lc->options[LC_PARTCHAR].arg.str = dbg_strdup((char*) "p");
 }
 
 static void init_cmd(struct lib_context *lc, void *arg)
man/dmraid.8 +11 -5
@@ -6,6 +6,7 @@
  {-a|--activate} {y|n|yes|no} 
  [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking]
  [-f|--format FORMAT[,FORMAT...]]
+ [{-P|--partchar} CHAR]
  [-p|--no_partitions]
  [--separator SEPARATOR]
  [-t|--test]
@@ -176,6 +177,10 @@
 is restricted to those listed.
 
 .TP
+.I [{-P|--partchar} CHAR]
+Use CHAR as the separator between the device name and the partition number.
+
+.TP
 .I {-r|--raid_devices} [device-path...]
 List all discovered RAID devices with format, RAID level, sectors used
 and data offset into the device.
@@ -187,10 +192,11 @@
 .B -D
 is added to
 .B -r
-the RAID metadata gets dumped into files named devicename_formatname.dat.
-The offset in sectors where the metadata is located on the device is written
-into files named devicename_formatname.offset and the size of the device
-into files named devicename_formatname.size.
+the RAID metadata gets dumped into a subdirectory named dmraid.format_name
+(eg. format_name = isw) in files named devicename.dat.
+The byte offset where the metadata is located on the device is written
+into files named devicename.offset and the size of the device in sectors
+into files named devicename.size.
 
 If 
 .B -E
@@ -214,7 +220,7 @@
 .br
 do
 .br
-	dd if=$f of=/dev/${f%%_*} \\
+	dd if=$f of=/dev/${f%%.dat} \\
 .br
 	seek=`cat ${f%%dat}offset` bs=1
 .br
tools/VERSION +1 -1
@@ -1 +1 @@
-1.0.0.rc14 (2006.11.08)
+1.0.0.rc15 (2008.04.02)
tools/commands.c +25 -1
@@ -24,7 +24,7 @@
 /*
  * Command line options.
  */
-static char const *short_opts = "a:hip"
+static char const *short_opts = "a:hipP:"
 #ifndef	DMRAID_MINI
 				"bc::dDEf:gl"
 #ifdef	DMRAID_NATIVE_LOG
@@ -38,6 +38,7 @@
 static struct option long_opts[] = {
 	{"activate", required_argument, NULL, 'a'},
 	{"format", required_argument, NULL, 'f'},
+	{"partchar", required_argument, NULL, 'P'},
 	{"no_partitions", no_argument, NULL, 'p'},
 # ifndef DMRAID_MINI
 	{"block_devices", no_argument, NULL, 'b'},
@@ -148,6 +149,14 @@
 }
 #endif
 
+/* Check and store option for partition separator. */
+static int check_part_separator(struct lib_context *lc, int arg)
+{
+	/* We're not actually checking that it's only one character... if
+	   somebody wants to use more, it shouldn't hurt anything. */
+	return lc_stralloc_opt(lc, LC_PARTCHAR, optarg) ? 1 : 0;
+}
+
 /* Display help information */
 static int help(struct lib_context *lc, int arg)
 {
@@ -158,6 +167,7 @@
 		  "[Early Boot Version]\n", c);
 	log_print(lc, "%s\t{-a|--activate} {y|n|yes|no} [-i|--ignorelocking]\n"
 		  "\t[-f|--format FORMAT[,FORMAT...]]\n"
+		  "\t[-P|--partchar CHAR]\n"
 		  "\t[-p|--no_partitions]\n"
 		  "\t[--separator SEPARATOR]\n"
 		  "\t[RAID-set...]\n", c);
@@ -168,6 +178,7 @@
 	log_print(lc, "* = [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking]\n");
 	log_print(lc, "%s\t{-a|--activate} {y|n|yes|no} *\n"
 		  "\t[-f|--format FORMAT[,FORMAT...]]\n"
+		  "\t[-P|--partchar CHAR]\n"
 		  "\t[-p|--no_partitions]\n"
 		  "\t[--separator SEPARATOR]\n"
 		  "\t[-t|--test]\n"
@@ -249,6 +260,19 @@
 	  LC_FORMAT,
 	},
 
+	/* Partition separator. */
+	{ 'P',
+	  PARTCHAR,
+	  ACTIVATE|DEACTIVATE,
+	  FORMAT|HELP|IGNORELOCKING|SEPARATOR
+#ifndef DMRAID_MINI
+	  |DBG|TEST|VERBOSE
+#endif
+	  , ARGS,
+	  check_part_separator,
+	  0,
+	},
+
 	/* Partition option. */
 	{ 'p',
 	  NOPARTITIONS,
tools/commands.h +1 -0
@@ -46,6 +46,7 @@
 #endif
 	VERSION		= 0x100000,
 	IGNORELOCKING	= 0x200000,
+	PARTCHAR	= 0x400000,
 };
 
 #define	ALL_FLAGS	((enum action) -1)