svn commit: r215667 - stable/8/sbin/fdisk
Brian Somers
brian at FreeBSD.org
Mon Nov 22 09:32:55 UTC 2010
Author: brian
Date: Mon Nov 22 09:32:54 2010
New Revision: 215667
URL: http://svn.freebsd.org/changeset/base/215667
Log:
MFC r212247 & r212724 from head:
Handle geli-encrypted root disk devices.
Add support for identifying a journaled root filesystem.
Fix support for identifying the given /dev/vinum/root example.
Modified:
stable/8/sbin/fdisk/fdisk.c
Directory Properties:
stable/8/sbin/fdisk/ (props changed)
Modified: stable/8/sbin/fdisk/fdisk.c
==============================================================================
--- stable/8/sbin/fdisk/fdisk.c Mon Nov 22 09:25:32 2010 (r215666)
+++ stable/8/sbin/fdisk/fdisk.c Mon Nov 22 09:32:54 2010 (r215667)
@@ -1461,6 +1461,8 @@ sanitize_partition(struct dos_partition
* /dev/ad0s1a => /dev/ad0
* /dev/da0a => /dev/da0
* /dev/vinum/root => /dev/vinum/root
+ * A ".eli" part is removed if it exists (see geli(8)).
+ * A ".journal" ending is removed if it exists (see gjournal(8)).
*/
static char *
get_rootdisk(void)
@@ -1469,16 +1471,20 @@ get_rootdisk(void)
regex_t re;
#define NMATCHES 2
regmatch_t rm[NMATCHES];
- char *s;
+ char dev[PATH_MAX], *s;
int rv;
if (statfs("/", &rootfs) == -1)
err(1, "statfs(\"/\")");
- if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]+)([sp][0-9]+)?[a-h]?$",
+ if ((rv = regcomp(&re, "^(/dev/[a-z/]+[0-9]*)([sp][0-9]+)?[a-h]?(\\.journal)?$",
REG_EXTENDED)) != 0)
errx(1, "regcomp() failed (%d)", rv);
- if ((rv = regexec(&re, rootfs.f_mntfromname, NMATCHES, rm, 0)) != 0)
+ strlcpy(dev, rootfs.f_mntfromname, sizeof (dev));
+ if ((s = strstr(dev, ".eli")) != NULL)
+ memmove(s, s+4, strlen(s + 4) + 1);
+
+ if ((rv = regexec(&re, dev, NMATCHES, rm, 0)) != 0)
errx(1,
"mounted root fs resource doesn't match expectations (regexec returned %d)",
rv);
More information about the svn-src-stable-8
mailing list