All of lore.kernel.org
 help / color / mirror / Atom feed
From: prajnoha@sourceware.org <prajnoha@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW_DM libdm/ioctl/libdm-iface.c
Date: 15 Feb 2012 12:17:35 -0000	[thread overview]
Message-ID: <20120215121735.17979.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha at sourceware.org	2012-02-15 12:17:35

Modified files:
	.              : WHATS_NEW_DM 
	libdm/ioctl    : libdm-iface.c 

Log message:
	Replace any '\' char with '\\' in table specification on input.
	
	Device-mapper in kernel uses '\' as escape character so it's better
	to double it to avoid any confusion when using existing device names
	with '\' in the table specification.
	
	For example:
	
	dmsetup create x --table "0 8 linear /dev/mapper/a\x20b 0"
	
	should pass just fine now without a need to explicitly escape the '\' char
	like this:
	
	dmsetup create x --table "0 8 linear /dev/mapper/a\\x20b 0"

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.563&r2=1.564
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.137&r2=1.138

--- LVM2/WHATS_NEW_DM	2012/02/15 12:08:57	1.563
+++ LVM2/WHATS_NEW_DM	2012/02/15 12:17:34	1.564
@@ -1,5 +1,6 @@
 Version 1.02.71 - 
 ====================================
+  Replace any '\' char with '\\' in table specification on input.
   Add mangle command to dmsetup to provide renaming to correct mangled form.
   Add 'mangled_name' and 'unmangled_name' fields to dmsetup info -c -o.
   Add --manglename option to dmsetup to select the name mangling mode.
--- LVM2/libdm/ioctl/libdm-iface.c	2012/02/15 12:01:28	1.137
+++ LVM2/libdm/ioctl/libdm-iface.c	2012/02/15 12:17:34	1.138
@@ -866,7 +866,9 @@
 	char *out_sp = out;
 	struct dm_target_spec sp;
 	size_t sp_size = sizeof(struct dm_target_spec);
+	unsigned int backslash_count = 0;
 	int len;
+	char *pt;
 
 	if (strlen(t->type) >= sizeof(sp.target_type)) {
 		log_error("Target type name %s is too long.", t->type);
@@ -880,15 +882,32 @@
 	sp.target_type[sizeof(sp.target_type) - 1] = '\0';
 
 	out += sp_size;
-	len = strlen(t->params);
+	pt = t->params;
+
+	while (*pt)
+		if (*pt++ == '\\')
+			backslash_count++;
+	len = strlen(t->params) + backslash_count;
 
 	if ((out >= end) || (out + len + 1) >= end) {
 		log_error("Ran out of memory building ioctl parameter");
 		return NULL;
 	}
 
-	strcpy(out, t->params);
-	out += len + 1;
+	if (backslash_count) {
+		/* replace "\" with "\\" */
+		pt = t->params;
+		do {
+			if (*pt == '\\')
+				*out++ = '\\';
+			*out++ = *pt++;
+		} while (*pt);
+		*out++ = '\0';
+	}
+	else {
+		strcpy(out, t->params);
+		out += len + 1;
+	}
 
 	/* align next block */
 	out = _align(out, ALIGNMENT);



             reply	other threads:[~2012-02-15 12:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 12:17 prajnoha [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-01 10:07 LVM2 ./WHATS_NEW_DM libdm/ioctl/libdm-iface.c zkabelac
2012-02-08 12:59 zkabelac
2012-02-08 11:25 zkabelac
2011-11-08 17:32 snitzer
2011-10-20 10:38 zkabelac
2011-09-13 15:13 prajnoha
2011-09-16 12:07 ` Alasdair G Kergon
2011-09-17 19:34   ` Mikulas Patocka
2011-08-11 20:49 zkabelac
2011-07-24 23:59 agk
2011-07-02  1:17 agk
2011-06-09 15:07 mbroz
2011-03-25 23:50 agk
2011-03-08 22:43 zkabelac
2011-03-01 23:27 agk
2011-02-21 16:26 snitzer
2010-08-18 13:11 prajnoha
2010-05-13 13:31 mbroz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120215121735.17979.qmail@sourceware.org \
    --to=prajnoha@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.