start = dos_partition_start(p) * ssf;
size = dos_partition_size(p) * ssf;
- if (!size)
+ if (!size) {
+ /* Linux kernel ignores empty partitions, but partno for
+ * the empty primary partitions is not reused */
+ blkid_partlist_increment_partno(ls);
continue;
-
+ }
par = blkid_partlist_add_partition(ls, tab, start, size);
if (!par)
goto err;
le64_to_cpu(e->starting_lba) + 1ULL;
/* 00000000-0000-0000-0000-000000000000 entry */
- if (!guidcmp(e->partition_type_guid, GPT_UNUSED_ENTRY_GUID))
+ if (!guidcmp(e->partition_type_guid, GPT_UNUSED_ENTRY_GUID)) {
+ blkid_partlist_increment_partno(ls);
continue;
-
+ }
/* the partition has to inside usable range */
if (start < fu || start + size - 1 > lu) {
DBG(DEBUG_LOWPROBE, printf(
"GPT entry[%d] overflows usable area - ignore\n",
i));
+ blkid_partlist_increment_partno(ls);
continue;
}
* @short_description: partitions tables detection and parsing
*
* This chain supports binary and NAME=value interfaces, but complete PT
- * description is provided by binary interface only.
+ * description is provided by binary interface only. The libblkid prober is
+ * compatible with kernel partition tables parser. The parser does not return
+ * empty (size=0) partitions or special hidden partitions.
*
* NAME=value interface, supported tags:
*
ref_parttable(tab);
par->tab = tab;
- par->partno = ls->next_partno++;
+ par->partno = blkid_partlist_increment_partno(ls);
return par;
}
return 0;
}
+int blkid_partlist_increment_partno(blkid_partlist ls)
+{
+ return ls ? ls->next_partno++ : -1;
+}
+
/* allows to set "parent" for the next nested partition */
int blkid_partlist_set_parent(blkid_partlist ls, blkid_partition par)
{
blkid_loff_t start, blkid_loff_t size);
extern int blkid_partlist_set_partno(blkid_partlist ls, int partno);
+extern int blkid_partlist_increment_partno(blkid_partlist ls);
+
extern blkid_partition blkid_partlist_get_parent(blkid_partlist ls);
extern int blkid_partitions_do_subprobe(blkid_probe pr,
blkid_partition par;
if (size == 0 || type == SGI_TYPE_VOLULME ||
- type == SGI_TYPE_VOLHDR)
+ type == SGI_TYPE_VOLHDR) {
+ blkid_partlist_increment_partno(ls);
continue;
-
+ }
par = blkid_partlist_add_partition(ls, tab, start, size);
if (!par)
goto err;
flags = be16_to_cpu(l->vtoc.infos[i].flags);
}
- if (type == SUN_TAG_WHOLEDISK || !size)
+ if (type == SUN_TAG_WHOLEDISK || !size) {
+ blkid_partlist_increment_partno(ls);
continue;
-
+ }
par = blkid_partlist_add_partition(ls, tab, start, size);
if (!par)
goto err;