Author: ae
Date: Fri May 27 06:37:42 2011
New Revision: 222341
URL: http://svn.freebsd.org/changeset/base/222341

Log:
  Some partitioning tools may have a different opinion about disk
  geometry and partitions may start from withing the first track.
  If we found such partitions, then do not reserve space of the
  first track, only first sector.

Modified:
  head/sys/geom/part/g_part_mbr.c

Modified: head/sys/geom/part/g_part_mbr.c
==============================================================================
--- head/sys/geom/part/g_part_mbr.c     Fri May 27 05:58:10 2011        
(r222340)
+++ head/sys/geom/part/g_part_mbr.c     Fri May 27 06:37:42 2011        
(r222341)
@@ -423,12 +423,13 @@ g_part_mbr_read(struct g_part_table *bas
        struct g_part_mbr_table *table;
        struct g_part_mbr_entry *entry;
        u_char *buf, *p;
-       off_t chs, msize;
+       off_t chs, msize, first;
        u_int sectors, heads;
        int error, index;
 
        pp = cp->provider;
        table = (struct g_part_mbr_table *)basetable;
+       first = basetable->gpt_sectors;
        msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 
        buf = g_read_data(cp, 0L, pp->sectorsize, &error);
@@ -461,7 +462,8 @@ g_part_mbr_read(struct g_part_table *bas
                                basetable->gpt_heads = heads;
                        }
                }
-
+               if (ent.dp_start < first)
+                       first = ent.dp_start;
                entry = (struct g_part_mbr_entry *)g_part_new_entry(basetable,
                    index + 1, ent.dp_start, ent.dp_start + ent.dp_size - 1);
                entry->ent = ent;
@@ -471,6 +473,9 @@ g_part_mbr_read(struct g_part_table *bas
        basetable->gpt_first = basetable->gpt_sectors;
        basetable->gpt_last = msize - 1;
 
+       if (first < basetable->gpt_first)
+               basetable->gpt_first = 1;
+
        g_free(buf);
        return (0);
 }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to