a5bd9f6
From d2634650c732823bd304e0413f84d383c2689117 Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Mon, 10 Dec 2012 11:12:38 +0100
a5bd9f6
Subject: [PATCH 059/364] 	* util/getroot.c
a5bd9f6
 (convert_system_partition_to_system_disk): Support 	nbd disks.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog      |  5 +++++
a5bd9f6
 util/getroot.c | 12 ++++++++++++
a5bd9f6
 2 files changed, 17 insertions(+)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 0b1596a..547f739 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,10 @@
a5bd9f6
 2012-12-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* util/getroot.c (convert_system_partition_to_system_disk): Support
a5bd9f6
+	nbd disks.
a5bd9f6
+
a5bd9f6
+2012-12-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	* grub-core/fs/ufs.c (grub_ufs_dir): Stop if direntlen is 0 to avoid
a5bd9f6
 	infinite loop on corrupted FS.
a5bd9f6
 
a5bd9f6
diff --git a/util/getroot.c b/util/getroot.c
a5bd9f6
index c2a25c9..24ce6aa 100644
a5bd9f6
--- a/util/getroot.c
a5bd9f6
+++ b/util/getroot.c
a5bd9f6
@@ -1796,6 +1796,18 @@ convert_system_partition_to_system_disk (const char *os_dev, struct stat *st,
a5bd9f6
 	  return path;
a5bd9f6
 	}
a5bd9f6
 
a5bd9f6
+      if (strncmp ("nbd", p, 3) == 0
a5bd9f6
+	  && p[3] >= '0' && p[3] <= '9')
a5bd9f6
+	{
a5bd9f6
+	  char *ptr = p + 3;
a5bd9f6
+	  while (*ptr >= '0' && *ptr <= '9')
a5bd9f6
+	    ptr++;
a5bd9f6
+	  if (*ptr)
a5bd9f6
+	    *is_part = 1;
a5bd9f6
+	  *ptr = 0;
a5bd9f6
+	  return path;
a5bd9f6
+	}
a5bd9f6
+
a5bd9f6
       /* If this is an IDE, SCSI or Virtio disk.  */
a5bd9f6
       if (strncmp ("vdisk", p, 5) == 0
a5bd9f6
 	  && p[5] >= 'a' && p[5] <= 'z')
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6