diff options
Diffstat (limited to 'libblkid/src/partitions')
-rw-r--r-- | libblkid/src/partitions/bsd.c | 16 | ||||
-rw-r--r-- | libblkid/src/partitions/dos.c | 6 | ||||
-rw-r--r-- | libblkid/src/partitions/gpt.c | 22 | ||||
-rw-r--r-- | libblkid/src/partitions/mac.c | 4 | ||||
-rw-r--r-- | libblkid/src/partitions/minix.c | 4 | ||||
-rw-r--r-- | libblkid/src/partitions/partitions.c | 67 | ||||
-rw-r--r-- | libblkid/src/partitions/sgi.c | 4 | ||||
-rw-r--r-- | libblkid/src/partitions/solaris_x86.c | 8 | ||||
-rw-r--r-- | libblkid/src/partitions/sun.c | 7 | ||||
-rw-r--r-- | libblkid/src/partitions/unixware.c | 4 |
10 files changed, 66 insertions, 76 deletions
diff --git a/libblkid/src/partitions/bsd.c b/libblkid/src/partitions/bsd.c index c39c78aa4..08fcad892 100644 --- a/libblkid/src/partitions/bsd.c +++ b/libblkid/src/partitions/bsd.c @@ -143,9 +143,9 @@ static int probe_bsd_pt(blkid_probe pr, const struct blkid_idmag *mag) name = "openbsd"; break; default: - DBG(DEBUG_LOWPROBE, printf( + DBG(LOWPROBE, blkid_debug( "WARNING: BSD label detected on unknown (0x%x) " - "primary partition\n", + "primary partition", blkid_partition_get_type(parent))); break; } @@ -159,8 +159,8 @@ static int probe_bsd_pt(blkid_probe pr, const struct blkid_idmag *mag) nparts = le16_to_cpu(l->d_npartitions); else if (le16_to_cpu(l->d_npartitions) > BSD_MAXPARTITIONS) - DBG(DEBUG_LOWPROBE, printf( - "WARNING: ignore %d more BSD partitions\n", + DBG(LOWPROBE, blkid_debug( + "WARNING: ignore %d more BSD partitions", le16_to_cpu(l->d_npartitions) - BSD_MAXPARTITIONS)); for (i = 0, p = l->d_partitions; i < nparts; i++, p++) { @@ -176,15 +176,15 @@ static int probe_bsd_pt(blkid_probe pr, const struct blkid_idmag *mag) if (parent && blkid_partition_get_start(parent) == start && blkid_partition_get_size(parent) == size) { - DBG(DEBUG_LOWPROBE, printf( + DBG(LOWPROBE, blkid_debug( "WARNING: BSD partition (%d) same like parent, " - "ignore\n", i)); + "ignore", i)); continue; } if (parent && !blkid_is_nested_dimension(parent, start, size)) { - DBG(DEBUG_LOWPROBE, printf( + DBG(LOWPROBE, blkid_debug( "WARNING: BSD partition (%d) overflow " - "detected, ignore\n", i)); + "detected, ignore", i)); continue; } diff --git a/libblkid/src/partitions/dos.c b/libblkid/src/partitions/dos.c index 58877691d..3a0a6d73e 100644 --- a/libblkid/src/partitions/dos.c +++ b/libblkid/src/partitions/dos.c @@ -153,7 +153,7 @@ static int probe_dos_pt(blkid_probe pr, * partition table. */ if (blkid_probe_is_vfat(pr)) { - DBG(DEBUG_LOWPROBE, printf("probably FAT -- ignore\n")); + DBG(LOWPROBE, blkid_debug("probably FAT -- ignore")); goto nothing; } @@ -164,7 +164,7 @@ static int probe_dos_pt(blkid_probe pr, */ for (p = p0, i = 0; i < 4; i++, p++) if (p->boot_ind != 0 && p->boot_ind != 0x80) { - DBG(DEBUG_LOWPROBE, printf("missing boot indicator -- ignore\n")); + DBG(LOWPROBE, blkid_debug("missing boot indicator -- ignore")); goto nothing; } @@ -173,7 +173,7 @@ static int probe_dos_pt(blkid_probe pr, */ for (p = p0, i = 0; i < 4; i++, p++) { if (p->sys_type == BLKID_GPT_PARTITION) { - DBG(DEBUG_LOWPROBE, printf("probably GPT -- ignore\n")); + DBG(LOWPROBE, blkid_debug("probably GPT -- ignore")); goto nothing; } } diff --git a/libblkid/src/partitions/gpt.c b/libblkid/src/partitions/gpt.c index 7288d683e..444193929 100644 --- a/libblkid/src/partitions/gpt.c +++ b/libblkid/src/partitions/gpt.c @@ -232,14 +232,14 @@ static struct gpt_header *get_gpt_header( h->header_crc32 = orgcrc; if (crc != le32_to_cpu(orgcrc)) { - DBG(DEBUG_LOWPROBE, printf("GPT header corrupted\n")); + DBG(LOWPROBE, blkid_debug("GPT header corrupted")); return NULL; } /* Valid header has to be at MyLBA */ if (le64_to_cpu(h->my_lba) != lba) { - DBG(DEBUG_LOWPROBE, printf( - "GPT->MyLBA mismatch with real position\n")); + DBG(LOWPROBE, blkid_debug( + "GPT->MyLBA mismatch with real position")); return NULL; } @@ -248,14 +248,14 @@ static struct gpt_header *get_gpt_header( /* Check if First and Last usable LBA makes sense */ if (lu < fu || fu > lastlba || lu > lastlba) { - DBG(DEBUG_LOWPROBE, printf( - "GPT->{First,Last}UsableLBA out of range\n")); + DBG(LOWPROBE, blkid_debug( + "GPT->{First,Last}UsableLBA out of range")); return NULL; } /* The header has to be outside usable range */ if (fu < lba && lba < lu) { - DBG(DEBUG_LOWPROBE, printf("GPT header is inside usable area\n")); + DBG(LOWPROBE, blkid_debug("GPT header is inside usable area")); return NULL; } @@ -263,7 +263,7 @@ static struct gpt_header *get_gpt_header( esz = le32_to_cpu(h->num_partition_entries) * le32_to_cpu(h->sizeof_partition_entry); if (!esz) { - DBG(DEBUG_LOWPROBE, printf("GPT entries undefined\n")); + DBG(LOWPROBE, blkid_debug("GPT entries undefined")); return NULL; } @@ -276,14 +276,14 @@ static struct gpt_header *get_gpt_header( *ents = (struct gpt_entry *) get_lba_buffer(pr, le64_to_cpu(h->partition_entries_lba), esz); if (!*ents) { - DBG(DEBUG_LOWPROBE, printf("GPT entries unreadable\n")); + DBG(LOWPROBE, blkid_debug("GPT entries unreadable")); return NULL; } /* Validate entries */ crc = count_crc32((unsigned char *) *ents, esz); if (crc != le32_to_cpu(h->partition_entry_array_crc32)) { - DBG(DEBUG_LOWPROBE, printf("GPT entries corrupted\n")); + DBG(LOWPROBE, blkid_debug("GPT entries corrupted")); return NULL; } @@ -357,8 +357,8 @@ static int probe_gpt_pt(blkid_probe pr, } /* 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", + DBG(LOWPROBE, blkid_debug( + "GPT entry[%d] overflows usable area - ignore", i)); blkid_partlist_increment_partno(ls); continue; diff --git a/libblkid/src/partitions/mac.c b/libblkid/src/partitions/mac.c index e18896cba..7f8bb75ef 100644 --- a/libblkid/src/partitions/mac.c +++ b/libblkid/src/partitions/mac.c @@ -130,9 +130,9 @@ static int probe_mac_pt(blkid_probe pr, goto nothing; if (be32_to_cpu(p->map_count) != nblks) { - DBG(DEBUG_LOWPROBE, printf( + DBG(LOWPROBE, blkid_debug( "mac: inconsisten map_count in partition map, " - "entry[0]: %d, entry[%d]: %d\n", + "entry[0]: %d, entry[%d]: %d", nblks, i - 1, be32_to_cpu(p->map_count))); } diff --git a/libblkid/src/partitions/minix.c b/libblkid/src/partitions/minix.c index bd57a6d4b..0cd9f432e 100644 --- a/libblkid/src/partitions/minix.c +++ b/libblkid/src/partitions/minix.c @@ -64,9 +64,9 @@ static int probe_minix_pt(blkid_probe pr, size = dos_partition_size(p); if (parent && !blkid_is_nested_dimension(parent, start, size)) { - DBG(DEBUG_LOWPROBE, printf( + DBG(LOWPROBE, blkid_debug( "WARNING: minix partition (%d) overflow " - "detected, ignore\n", i)); + "detected, ignore", i)); continue; } diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c index 93ec4d224..87ca0c1f8 100644 --- a/libblkid/src/partitions/partitions.c +++ b/libblkid/src/partitions/partitions.c @@ -361,7 +361,7 @@ static void reset_partlist(blkid_partlist ls) ls->next_partno = 1; INIT_LIST_HEAD(&ls->l_tabs); - DBG(DEBUG_LOWPROBE, printf("partlist reset\n")); + DBG(LOWPROBE, blkid_debug("partlist reset")); } static blkid_partlist partitions_init_data(struct blkid_chain *chn) @@ -380,8 +380,7 @@ static blkid_partlist partitions_init_data(struct blkid_chain *chn) reset_partlist(ls); - DBG(DEBUG_LOWPROBE, - printf("parts: initialized partitions list (%p, size=%d)\n", + DBG(LOWPROBE, blkid_debug("parts: initialized partitions list (%p, size=%d)", ls, ls->nparts_max)); return ls; } @@ -416,9 +415,8 @@ blkid_parttable blkid_partlist_new_parttable(blkid_partlist ls, INIT_LIST_HEAD(&tab->t_tabs); list_add_tail(&tab->t_tabs, &ls->l_tabs); - DBG(DEBUG_LOWPROBE, - printf("parts: create a new partition table " - "(%p, type=%s, offset=%"PRId64")\n", tab, type, offset)); + DBG(LOWPROBE, blkid_debug("parts: create a new partition table " + "(%p, type=%s, offset=%"PRId64")", tab, type, offset)); return tab; } @@ -459,9 +457,8 @@ blkid_partition blkid_partlist_add_partition(blkid_partlist ls, par->start = start; par->size = size; - DBG(DEBUG_LOWPROBE, - printf("parts: add partition (%p start=%" - PRId64 ", size=%" PRId64 ", table=%p)\n", + DBG(LOWPROBE, blkid_debug("parts: add partition (%p start=%" + PRId64 ", size=%" PRId64 ", table=%p)", par, par->start, par->size, tab)); return par; } @@ -545,23 +542,21 @@ static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id, /* final check by probing function */ if (id->probefunc) { - DBG(DEBUG_LOWPROBE, printf( - "%s: ---> call probefunc()\n", id->name)); + DBG(LOWPROBE, blkid_debug( + "%s: ---> call probefunc()", id->name)); rc = id->probefunc(pr, mag); if (rc == -1) { /* reset after error */ reset_partlist(blkid_probe_get_partlist(pr)); if (chn && !chn->binary) blkid_probe_chain_reset_vals(pr, chn); - DBG(DEBUG_LOWPROBE, printf( - "%s probefunc failed\n", id->name)); + DBG(LOWPROBE, blkid_debug("%s probefunc failed", id->name)); } if (rc == 0 && mag && chn && !chn->binary) rc = blkid_probe_set_magic(pr, off, mag->len, (unsigned char *) mag->magic); - DBG(DEBUG_LOWPROBE, printf( - "%s: <--- (rc = %d)\n", id->name, rc)); + DBG(LOWPROBE, blkid_debug("%s: <--- (rc = %d)", id->name, rc)); } nothing: @@ -586,8 +581,7 @@ static int partitions_probe(blkid_probe pr, struct blkid_chain *chn) if (!pr->wipe_size && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_PT)) goto details_only; - DBG(DEBUG_LOWPROBE, - printf("--> starting probing loop [PARTS idx=%d]\n", + DBG(LOWPROBE, blkid_debug("--> starting probing loop [PARTS idx=%d]", chn->idx)); i = chn->idx < 0 ? 0 : chn->idx + 1U; @@ -612,16 +606,14 @@ static int partitions_probe(blkid_probe pr, struct blkid_chain *chn) blkid_probe_set_value(pr, "PTTYPE", (unsigned char *) name, strlen(name) + 1); - DBG(DEBUG_LOWPROBE, - printf("<-- leaving probing loop (type=%s) [PARTS idx=%d]\n", + DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [PARTS idx=%d]", name, chn->idx)); rc = 0; break; } if (rc == 1) { - DBG(DEBUG_LOWPROBE, - printf("<-- leaving probing loop (failed) [PARTS idx=%d]\n", + DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed) [PARTS idx=%d]", chn->idx)); } @@ -648,8 +640,8 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent, blkid_partlist ls; blkid_loff_t sz, off; - DBG(DEBUG_LOWPROBE, printf( - "parts: ----> %s subprobe requested (parent=%p)\n", + DBG(LOWPROBE, blkid_debug( + "parts: ----> %s subprobe requested (parent=%p)", id->name, parent)); if (!pr || !parent || !parent->size) @@ -660,8 +652,8 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent, off = ((blkid_loff_t) parent->start) << 9; if (off < pr->off || pr->off + pr->size < off + sz) { - DBG(DEBUG_LOWPROBE, printf( - "ERROR: parts: <---- '%s' subprobe: overflow detected.\n", + DBG(LOWPROBE, blkid_debug( + "ERROR: parts: <---- '%s' subprobe: overflow detected.", id->name)); return -1; } @@ -693,8 +685,8 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent, blkid_free_probe(prc); /* free cloned prober */ - DBG(DEBUG_LOWPROBE, printf( - "parts: <---- %s subprobe done (parent=%p, rc=%d)\n", + DBG(LOWPROBE, blkid_debug( + "parts: <---- %s subprobe done (parent=%p, rc=%d)", id->name, parent, rc)); return rc; @@ -785,8 +777,8 @@ int blkid_probe_is_covered_by_pt(blkid_probe pr, blkid_loff_t start, end; int nparts, i, rc = 0; - DBG(DEBUG_LOWPROBE, printf( - "=> checking if off=%jd size=%jd covered by PT\n", + DBG(LOWPROBE, blkid_debug( + "=> checking if off=%jd size=%jd covered by PT", offset, size)); prc = blkid_clone_probe(pr); @@ -809,8 +801,8 @@ int blkid_probe_is_covered_by_pt(blkid_probe pr, blkid_partition par = &ls->parts[i]; if (par->start + par->size > (pr->size >> 9)) { - DBG(DEBUG_LOWPROBE, printf("partition #%d overflows " - "device (off=%" PRId64 " size=%" PRId64 ")\n", + DBG(LOWPROBE, blkid_debug("partition #%d overflows " + "device (off=%" PRId64 " size=%" PRId64 ")", par->partno, par->start, par->size)); goto done; } @@ -828,7 +820,7 @@ int blkid_probe_is_covered_by_pt(blkid_probe pr, done: blkid_free_probe(prc); - DBG(DEBUG_LOWPROBE, printf("<= %s covered by PT\n", rc ? "IS" : "NOT")); + DBG(LOWPROBE, blkid_debug("<= %s covered by PT", rc ? "IS" : "NOT")); return rc; } @@ -924,12 +916,11 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno if (!ls) return NULL; - DBG(DEBUG_LOWPROBE, - printf("triyng to convert devno 0x%llx to partition\n", + DBG(LOWPROBE, blkid_debug("triyng to convert devno 0x%llx to partition", (long long) devno)); if (sysfs_init(&sysfs, devno, NULL)) { - DBG(DEBUG_LOWPROBE, printf("failed t init sysfs context\n")); + DBG(LOWPROBE, blkid_debug("failed t init sysfs context")); return NULL; } rc = sysfs_read_u64(&sysfs, "size", &size); @@ -961,7 +952,7 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno return NULL; if (partno) { - DBG(DEBUG_LOWPROBE, printf("mapped by DM, using partno %d\n", partno)); + DBG(LOWPROBE, blkid_debug("mapped by DM, using partno %d", partno)); /* * Partition mapped by kpartx does not provide "start" offset @@ -983,7 +974,7 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno return NULL; } - DBG(DEBUG_LOWPROBE, printf("searching by offset/size\n")); + DBG(LOWPROBE, blkid_debug("searching by offset/size")); for (i = 0; i < ls->nparts; i++) { blkid_partition par = &ls->parts[i]; @@ -999,7 +990,7 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno } - DBG(DEBUG_LOWPROBE, printf("not found partition for device\n")); + DBG(LOWPROBE, blkid_debug("not found partition for device")); return NULL; } diff --git a/libblkid/src/partitions/sgi.c b/libblkid/src/partitions/sgi.c index b89e46320..b292e7150 100644 --- a/libblkid/src/partitions/sgi.c +++ b/libblkid/src/partitions/sgi.c @@ -103,8 +103,8 @@ static int probe_sgi_pt(blkid_probe pr, goto nothing; if (count_checksum(l)) { - DBG(DEBUG_LOWPROBE, printf( - "detected corrupted sgi disk label -- ignore\n")); + DBG(LOWPROBE, blkid_debug( + "detected corrupted sgi disk label -- ignore")); goto nothing; } diff --git a/libblkid/src/partitions/solaris_x86.c b/libblkid/src/partitions/solaris_x86.c index 7824f4ee7..4e08caf20 100644 --- a/libblkid/src/partitions/solaris_x86.c +++ b/libblkid/src/partitions/solaris_x86.c @@ -73,8 +73,8 @@ static int probe_solaris_pt(blkid_probe pr, goto nothing; if (le32_to_cpu(l->v_version) != 1) { - DBG(DEBUG_LOWPROBE, printf( - "WARNING: unsupported solaris x86 version %d, ignore\n", + DBG(LOWPROBE, blkid_debug( + "WARNING: unsupported solaris x86 version %d, ignore", le32_to_cpu(l->v_version))); goto nothing; } @@ -112,9 +112,9 @@ static int probe_solaris_pt(blkid_probe pr, start += blkid_partition_get_start(parent); if (parent && !blkid_is_nested_dimension(parent, start, size)) { - DBG(DEBUG_LOWPROBE, printf( + DBG(LOWPROBE, blkid_debug( "WARNING: solaris partition (%d) overflow " - "detected, ignore\n", i)); + "detected, ignore", i)); continue; } diff --git a/libblkid/src/partitions/sun.c b/libblkid/src/partitions/sun.c index c2c700d96..ba7ca3a5e 100644 --- a/libblkid/src/partitions/sun.c +++ b/libblkid/src/partitions/sun.c @@ -31,8 +31,8 @@ static int probe_sun_pt(blkid_probe pr, goto nothing; if (sun_pt_checksum(l)) { - DBG(DEBUG_LOWPROBE, printf( - "detected corrupted sun disk label -- ignore\n")); + DBG(LOWPROBE, blkid_debug( + "detected corrupted sun disk label -- ignore")); goto nothing; } @@ -51,8 +51,7 @@ static int probe_sun_pt(blkid_probe pr, /* sectors per cylinder (partition offset is in cylinders...) */ spc = be16_to_cpu(l->nhead) * be16_to_cpu(l->nsect); - DBG(DEBUG_LOWPROBE, - printf("Sun VTOC sanity=%u version=%u nparts=%u\n", + DBG(LOWPROBE, blkid_debug("Sun VTOC sanity=%u version=%u nparts=%u", be32_to_cpu(l->vtoc.sanity), be32_to_cpu(l->vtoc.version), be16_to_cpu(l->vtoc.nparts))); diff --git a/libblkid/src/partitions/unixware.c b/libblkid/src/partitions/unixware.c index e9bcba358..ce176b8d0 100644 --- a/libblkid/src/partitions/unixware.c +++ b/libblkid/src/partitions/unixware.c @@ -147,9 +147,9 @@ static int probe_unixware_pt(blkid_probe pr, size = le32_to_cpu(p->nr_sects); if (parent && !blkid_is_nested_dimension(parent, start, size)) { - DBG(DEBUG_LOWPROBE, printf( + DBG(LOWPROBE, blkid_debug( "WARNING: unixware partition (%d) overflow " - "detected, ignore\n", i)); + "detected, ignore", i)); continue; } |