From: Richard Laager <rlaager@wiktel.com>
To: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
Cc: grub-devel@gnu.org
Subject: Re: [Patch] Robustly search for ZFS labels & uberblocks
Date: Fri, 03 Feb 2012 05:20:54 -0600 [thread overview]
Message-ID: <1328268054.17279.25.camel@watermelon.coderich.net> (raw)
In-Reply-To: <4F2BAE50.5060809@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 519 bytes --]
On Fri, 2012-02-03 at 10:52 +0100, Vladimir 'φ-coder/phcoder' Serbinenko
wrote:
> > zfs-on-linux-rlaager6.patch
> >
> >
> > Handle pool names with trailing spaces
> What about the ones with spaces in the middle? It feels like the logic
> is broken elsewhere and using strncmp is just a workaround which works
> only for one particular case
I've attached a new patch. I've tested it with both cases.
I've also attached a patch that handles `zpool status` outputting full
device paths.
--
Richard
[-- Attachment #1.2: zfs-devices.patch --]
[-- Type: text/x-patch, Size: 573 bytes --]
Handle vdevs with full paths
Index: util/getroot.c
===================================================================
--- util/getroot.c 2012-02-03 04:21:29.199249594 -0600
+++ util/getroot.c 2012-02-03 05:02:55.693211000 -0600
@@ -302,7 +301,10 @@
devices = xrealloc (devices, sizeof (devices[0])
* devices_allocated);
}
- devices[ndevices++] = xasprintf ("/dev/%s", name);
+ if (name[0] == '/')
+ devices[ndevices++] = xstrdup (name);
+ else
+ devices[ndevices++] = xasprintf ("/dev/%s", name);
}
break;
}
[-- Attachment #1.3: zfs-poolname-spaces.patch --]
[-- Type: text/x-patch, Size: 1079 bytes --]
Handle pool names with spaces
Index: util/getroot.c
===================================================================
--- util/getroot.c 2012-02-03 04:21:29.199249594 -0600
+++ util/getroot.c 2012-02-03 05:02:55.693211000 -0600
@@ -260,7 +260,7 @@
char cksum[257], notes[257];
unsigned int dummy;
- cmd = xasprintf ("zpool status %s", poolname);
+ cmd = xasprintf ("zpool status \"%s\"", poolname);
fp = popen (cmd, "r");
free (cmd);
@@ -285,8 +285,7 @@
st++;
break;
case 1:
- if (!strcmp (name, poolname))
- st++;
+ st++;
break;
case 2:
if (strcmp (name, "mirror") && !sscanf (name, "mirror-%u", &dummy)
@@ -420,6 +422,9 @@
if (sscanf (sep, "%s %s", entry.fstype, entry.device) != 2)
continue;
+ unescape (entry.fstype);
+ unescape (entry.device);
+
/* Using the mount IDs, find out where this fits in the list of
visible mount entries we've seen so far. There are three
interesting cases. Firstly, it may be inserted at the end: this is
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-02-03 11:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 18:45 [Patch] Robustly search for ZFS labels & uberblocks Zachary Bedell
2011-09-28 21:20 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-19 11:36 ` Richard Laager
2012-01-22 14:18 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-22 20:31 ` Richard Laager
2012-01-24 7:12 ` Richard Laager
2012-01-27 19:04 ` Zachary Bedell
2012-01-27 22:22 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-28 2:50 ` Richard Laager
2012-01-28 12:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-28 16:50 ` Richard Laager
2012-01-28 17:06 ` Darik Horn
2012-01-28 17:39 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-28 18:33 ` Richard Laager
2012-01-28 19:21 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-29 22:42 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-31 8:45 ` Richard Laager
2012-02-02 11:13 ` Richard Laager
2012-02-03 10:02 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-03 9:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-02-03 11:20 ` Richard Laager [this message]
2012-01-28 18:40 ` Darik Horn
2012-01-28 19:27 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-01-30 1:22 ` Richard Laager
2012-01-30 1:43 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-03 14:45 ` Vladimir 'φ-coder/phcoder' Serbinenko
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=1328268054.17279.25.camel@watermelon.coderich.net \
--to=rlaager@wiktel.com \
--cc=grub-devel@gnu.org \
--cc=phcoder@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).