#ifndef _BLKID_BLKIDP_H
#define _BLKID_BLKIDP_H
-/* support debug output if LIBBLKID_DEBUG env. variable is set */
-#define CONFIG_BLKID_DEBUG 1
-
/* Always confirm that /dev/disk-by symlinks match with LABEL/UUID on device */
/* #define CONFIG_BLKID_VERIFY_UDEV 1 */
#define BLKID_PRI_LVM 20
#define BLKID_PRI_MD 10
-#if defined(TEST_PROGRAM) && !defined(CONFIG_BLKID_DEBUG)
-#define CONFIG_BLKID_DEBUG
-#endif
-
#define BLKID_DEBUG_CACHE 0x0001
#define BLKID_DEBUG_DUMP 0x0002
#define BLKID_DEBUG_DEV 0x0004
#define BLKID_DEBUG_INIT 0x8000
#define BLKID_DEBUG_ALL 0xFFFF
-#define BLKID_DEF_FLAG(m) UL_DEFINE_FLAG(BLKID_DEBUG_, m)
-
UL_DEBUG_DECLARE_MASK(libblkid);
+#define DBG(m, x) __UL_DBG(libblkid, BLKID_DEBUG_, m, x)
+
extern void blkid_debug_dump_dev(blkid_dev dev);
extern void blkid_debug_dump_tag(blkid_tag tag);
-#define DBG(m, x) do { __UL_DBG(libblkid, BLKID_DEBUG_, m, x); } while (0)
-
-static inline void __attribute__ ((__format__ (__printf__, 1, 2)))
-blkid_debug(const char *mesg, ...)
-{
- va_list ap;
- va_start(ap, mesg);
- vfprintf(stderr, mesg, ap);
- va_end(ap);
- fputc('\n', stderr);
-}
/* devno.c */
struct dir_list {
blkid_init_debug(0);
- DBG(CACHE, blkid_debug("creating blkid cache (using %s)",
+ DBG(CACHE, ul_debug("creating blkid cache (using %s)",
filename ? filename : "default cache"));
if (!(cache = (blkid_cache) calloc(1, sizeof(struct blkid_struct_cache))))
(void) blkid_flush_cache(cache);
- DBG(CACHE, blkid_debug("freeing cache struct"));
+ DBG(CACHE, ul_debug("freeing cache struct"));
- /* DBG(CACHE, blkid_debug_dump_cache(cache)); */
+ /* DBG(CACHE, ul_debug_dump_cache(cache)); */
while (!list_empty(&cache->bic_devs)) {
blkid_dev dev = list_entry(cache->bic_devs.next,
struct blkid_struct_tag,
bit_names);
- DBG(CACHE, blkid_debug("warning: unfreed tag %s=%s",
+ DBG(CACHE, ul_debug("warning: unfreed tag %s=%s",
bad->bit_name, bad->bit_val));
blkid_free_tag(bad);
}
list_for_each_safe(p, pnext, &cache->bic_devs) {
blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
if (stat(dev->bid_name, &st) < 0) {
- DBG(CACHE, blkid_debug("freeing %s", dev->bid_name));
+ DBG(CACHE, ul_debug("freeing %s", dev->bid_name));
blkid_free_dev(dev);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
} else {
- DBG(CACHE, blkid_debug("Device %s exists", dev->bid_name));
+ DBG(CACHE, ul_debug("Device %s exists", dev->bid_name));
}
}
}
}
return 0;
err:
- DBG(CONFIG, blkid_debug(
+ DBG(CONFIG, ul_debug(
"config file: unknown evaluation method '%s'.", s));
return -1;
}
if (feof(fd))
s = strchr (buf, '\0');
else {
- DBG(CONFIG, blkid_debug(
+ DBG(CONFIG, ul_debug(
"config file: missing newline at line '%s'.",
buf));
return -1;
if (*s && parse_evaluate(conf, s) == -1)
return -1;
} else {
- DBG(CONFIG, blkid_debug(
+ DBG(CONFIG, ul_debug(
"config file: unknown option '%s'.", s));
return -1;
}
return NULL;
conf->uevent = -1;
- DBG(CONFIG, blkid_debug("reading config file: %s.", filename));
+ DBG(CONFIG, ul_debug("reading config file: %s.", filename));
f = fopen(filename, "r" UL_CLOEXECSTR);
if (!f) {
- DBG(CONFIG, blkid_debug("%s: does not exist, using built-in default", filename));
+ DBG(CONFIG, ul_debug("%s: does not exist, using built-in default", filename));
goto dflt;
}
while (!feof(f)) {
if (parse_next(f, conf)) {
- DBG(CONFIG, blkid_debug("%s: parse error", filename));
+ DBG(CONFIG, ul_debug("%s: parse error", filename));
goto err;
}
}
return;
DBG(DEV,
- blkid_debug(" freeing dev %s (%s)", dev->bid_name, dev->bid_type ?
+ ul_debug(" freeing dev %s (%s)", dev->bid_name, dev->bid_type ?
dev->bid_type : "(null)"));
DBG(DEV, blkid_debug_dump_dev(dev));
return dev ? dev->bid_name : NULL;
}
-#ifdef CONFIG_BLKID_DEBUG
void blkid_debug_dump_dev(blkid_dev dev)
{
struct list_head *p;
fprintf(stderr, " tag: NULL\n");
}
}
-#endif
/*
* dev iteration routines for the public libblkid interface.
if (strcmp(tmp->bid_name, devname))
continue;
- DBG(DEVNAME, blkid_debug("found devname %s in cache", tmp->bid_name));
+ DBG(DEVNAME, ul_debug("found devname %s in cache", tmp->bid_name));
dev = tmp;
break;
}
int ma, mi;
dev_t ret = 0;
- DBG(DEVNAME, blkid_debug("opening %s", lvm_device));
+ DBG(DEVNAME, ul_debug("opening %s", lvm_device));
if ((lvf = fopen(lvm_device, "r" UL_CLOEXECSTR)) == NULL) {
- DBG(DEVNAME, blkid_debug("%s: (%d) %m", lvm_device, errno));
+ DBG(DEVNAME, ul_debug("%s: (%d) %m", lvm_device, errno));
return 0;
}
if ((vg_list = opendir(VG_DIR)) == NULL)
return;
- DBG(DEVNAME, blkid_debug("probing LVM devices under %s", VG_DIR));
+ DBG(DEVNAME, ul_debug("probing LVM devices under %s", VG_DIR));
while ((vg_iter = readdir(vg_list)) != NULL) {
DIR *lv_list;
lv_name);
dev = lvm_get_devno(lvm_device);
sprintf(lvm_device, "%s/%s", vg_name, lv_name);
- DBG(DEVNAME, blkid_debug("LVM dev %s: devno 0x%04X",
+ DBG(DEVNAME, ul_debug("LVM dev %s: devno 0x%04X",
lvm_device,
(unsigned int) dev));
probe_one(cache, lvm_device, dev, BLKID_PRI_LVM,
&ma, &mi, &sz, device) != 4)
continue;
- DBG(DEVNAME, blkid_debug("Checking partition %s (%d, %d)",
+ DBG(DEVNAME, ul_debug("Checking partition %s (%d, %d)",
device, ma, mi));
probe_one(cache, device, makedev(ma, mi), BLKID_PRI_EVMS,
DIR *dir;
struct dirent *iter;
- DBG(DEVNAME, blkid_debug("probing UBI volumes under %s",
+ DBG(DEVNAME, ul_debug("probing UBI volumes under %s",
*dirname));
dir = opendir(*dirname);
if (!S_ISCHR(st.st_mode) || !minor(dev))
continue;
- DBG(DEVNAME, blkid_debug("UBI vol %s/%s: devno 0x%04X",
+ DBG(DEVNAME, ul_debug("UBI vol %s/%s: devno 0x%04X",
*dirname, name, (int) dev));
probe_one(cache, name, dev, BLKID_PRI_UBI, only_if_new, 0);
}
continue;
devs[which] = makedev(ma, mi);
- DBG(DEVNAME, blkid_debug("read partition name %s", ptname));
+ DBG(DEVNAME, ul_debug("read partition name %s", ptname));
/* Skip whole disk devs unless they have no partitions.
* If base name of device has changed, also
/* ends in a digit, clearly a partition, so check */
if (isdigit(ptname[lens[which] - 1])) {
- DBG(DEVNAME, blkid_debug("partition dev %s, devno 0x%04X",
+ DBG(DEVNAME, ul_debug("partition dev %s, devno 0x%04X",
ptname, (unsigned int) devs[which]));
if (sz > 1)
tmp = list_entry(p, struct blkid_struct_dev,
bid_devs);
if (tmp->bid_devno == devs[last]) {
- DBG(DEVNAME, blkid_debug("freeing %s",
+ DBG(DEVNAME, ul_debug("freeing %s",
tmp->bid_name));
blkid_free_dev(tmp);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
* check last as well.
*/
if (lens[last] && strncmp(ptnames[last], ptname, lens[last])) {
- DBG(DEVNAME, blkid_debug("whole dev %s, devno 0x%04X",
+ DBG(DEVNAME, ul_debug("whole dev %s, devno 0x%04X",
ptnames[last], (unsigned int) devs[last]));
probe_one(cache, ptnames[last], devs[last], 0,
only_if_new, 0);
{
int ret;
- DBG(PROBE, blkid_debug("Begin blkid_probe_all()"));
+ DBG(PROBE, ul_debug("Begin blkid_probe_all()"));
ret = probe_all(cache, 0);
if (ret == 0) {
cache->bic_time = time(0);
cache->bic_flags |= BLKID_BIC_FL_PROBED;
}
- DBG(PROBE, blkid_debug("End blkid_probe_all() [rc=%d]", ret));
+ DBG(PROBE, ul_debug("End blkid_probe_all() [rc=%d]", ret));
return ret;
}
{
int ret;
- DBG(PROBE, blkid_debug("Begin blkid_probe_all_new()"));
+ DBG(PROBE, ul_debug("Begin blkid_probe_all_new()"));
ret = probe_all(cache, 1);
- DBG(PROBE, blkid_debug("End blkid_probe_all_new() [rc=%d]", ret));
+ DBG(PROBE, ul_debug("End blkid_probe_all_new() [rc=%d]", ret));
return ret;
}
{
int ret;
- DBG(PROBE, blkid_debug("Begin blkid_probe_all_removable()"));
+ DBG(PROBE, ul_debug("Begin blkid_probe_all_removable()"));
ret = probe_all_removable(cache);
- DBG(PROBE, blkid_debug("End blkid_probe_all_removable() [rc=%d]", ret));
+ DBG(PROBE, ul_debug("End blkid_probe_all_removable() [rc=%d]", ret));
return ret;
}
if (S_ISBLK(st.st_mode) && st.st_rdev == devno) {
*devname = blkid_strconcat(dirname, "/", dp->d_name);
- DBG(DEVNO, blkid_debug("found 0x%llx at %s", (long long)devno,
+ DBG(DEVNO, ul_debug("found 0x%llx at %s", (long long)devno,
*devname));
break;
}
struct dir_list *current = list;
list = list->next;
- DBG(DEVNO, blkid_debug("directory %s", current->name));
+ DBG(DEVNO, ul_debug("directory %s", current->name));
blkid__scan_dir(current->name, devno, &new_list, &devname);
free(current->name);
free(current);
path = scandev_devno_to_devpath(devno);
if (!path) {
- DBG(DEVNO, blkid_debug("blkid: couldn't find devno 0x%04lx",
+ DBG(DEVNO, ul_debug("blkid: couldn't find devno 0x%04lx",
(unsigned long) devno));
} else {
- DBG(DEVNO, blkid_debug("found devno 0x%04llx as %s", (long long)devno, path));
+ DBG(DEVNO, ul_debug("found devno 0x%04llx as %s", (long long)devno, path));
}
return path;
fclose(f);
- DBG(DEVNO, blkid_debug("major %d %s associated with '%s' driver",
+ DBG(DEVNO, ul_debug("major %d %s associated with '%s' driver",
major, match ? "is" : "is NOT", drvname));
return match;
}
if (!rc)
rc = memcmp(value, data, len);
done:
- DBG(EVALUATE, blkid_debug("%s: %s verification %s",
+ DBG(EVALUATE, ul_debug("%s: %s verification %s",
devname, name, rc == 0 ? "PASS" : "FAILED"));
if (fd >= 0)
close(fd);
FILE *f;
int rc = -1;
- DBG(EVALUATE, blkid_debug("%s: uevent '%s' requested", devname, action));
+ DBG(EVALUATE, ul_debug("%s: uevent '%s' requested", devname, action));
if (!devname || !action)
return -1;
if (fputs(action, f) >= 0)
rc = 0;
if (close_stream(f) != 0)
- DBG(EVALUATE, blkid_debug("write failed: %s", uevent));
+ DBG(EVALUATE, ul_debug("write failed: %s", uevent));
}
- DBG(EVALUATE, blkid_debug("%s: send uevent %s",
+ DBG(EVALUATE, ul_debug("%s: send uevent %s",
uevent, rc == 0 ? "SUCCES" : "FAILED"));
return rc;
}
size_t len;
struct stat st;
- DBG(EVALUATE, blkid_debug("evaluating by udev %s=%s", token, value));
+ DBG(EVALUATE, ul_debug("evaluating by udev %s=%s", token, value));
if (!strcmp(token, "UUID"))
strcpy(dev, _PATH_DEV_BYUUID "/");
else if (!strcmp(token, "PARTUUID"))
strcpy(dev, _PATH_DEV_BYPARTUUID "/");
else {
- DBG(EVALUATE, blkid_debug("unsupported token %s", token));
+ DBG(EVALUATE, ul_debug("unsupported token %s", token));
return NULL; /* unsupported tag */
}
if (blkid_encode_string(value, &dev[len], sizeof(dev) - len) != 0)
return NULL;
- DBG(EVALUATE, blkid_debug("expected udev link: %s", dev));
+ DBG(EVALUATE, ul_debug("expected udev link: %s", dev));
if (stat(dev, &st))
goto failed; /* link or device does not exist */
return path;
failed:
- DBG(EVALUATE, blkid_debug("failed to evaluate by udev"));
+ DBG(EVALUATE, ul_debug("failed to evaluate by udev"));
if (uevent && path)
blkid_send_uevent(path, "change");
blkid_cache c = cache ? *cache : NULL;
char *res;
- DBG(EVALUATE, blkid_debug("evaluating by blkid scan %s=%s", token, value));
+ DBG(EVALUATE, ul_debug("evaluating by blkid scan %s=%s", token, value));
if (!c) {
char *cachefile = blkid_get_cache_filename(conf);
if (!cache || !*cache)
blkid_init_debug(0);
- DBG(EVALUATE, blkid_debug("evaluating %s%s%s", token, value ? "=" : "",
+ DBG(EVALUATE, ul_debug("evaluating %s%s%s", token, value ? "=" : "",
value ? value : ""));
if (!value) {
break;
}
- DBG(EVALUATE, blkid_debug("%s=%s evaluated as %s", token, value, ret));
+ DBG(EVALUATE, ul_debug("%s=%s evaluated as %s", token, value, ret));
out:
blkid_free_config(conf);
free(t);
const char *date = NULL;
blkid_get_library_version(&ver, &date);
- DBG(INIT, blkid_debug("library version: %s [%s]", ver, date));
+ DBG(INIT, ul_debug("library version: %s [%s]", ver, date));
}
}
name = "openbsd";
break;
default:
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: BSD label detected on unknown (0x%x) "
"primary partition",
blkid_partition_get_type(parent)));
nparts = le16_to_cpu(l->d_npartitions);
else if (le16_to_cpu(l->d_npartitions) > BSD_MAXPARTITIONS)
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: ignore %d more BSD partitions",
le16_to_cpu(l->d_npartitions) - BSD_MAXPARTITIONS));
if (parent && blkid_partition_get_start(parent) == start
&& blkid_partition_get_size(parent) == size) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: BSD partition (%d) same like parent, "
"ignore", i));
continue;
}
if (parent && !blkid_is_nested_dimension(parent, start, size)) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: BSD partition (%d) overflow "
"detected, ignore", i));
continue;
* partition table.
*/
if (blkid_probe_is_vfat(pr)) {
- DBG(LOWPROBE, blkid_debug("probably FAT -- ignore"));
+ DBG(LOWPROBE, ul_debug("probably FAT -- ignore"));
goto nothing;
}
*/
for (p = p0, i = 0; i < 4; i++, p++)
if (p->boot_ind != 0 && p->boot_ind != 0x80) {
- DBG(LOWPROBE, blkid_debug("missing boot indicator -- ignore"));
+ DBG(LOWPROBE, ul_debug("missing boot indicator -- ignore"));
goto nothing;
}
*/
for (p = p0, i = 0; i < 4; i++, p++) {
if (p->sys_ind == MBR_GPT_PARTITION) {
- DBG(LOWPROBE, blkid_debug("probably GPT -- ignore"));
+ DBG(LOWPROBE, ul_debug("probably GPT -- ignore"));
goto nothing;
}
}
h->header_crc32 = orgcrc;
if (crc != le32_to_cpu(orgcrc)) {
- DBG(LOWPROBE, blkid_debug("GPT header corrupted"));
+ DBG(LOWPROBE, ul_debug("GPT header corrupted"));
return NULL;
}
/* Valid header has to be at MyLBA */
if (le64_to_cpu(h->my_lba) != lba) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"GPT->MyLBA mismatch with real position"));
return NULL;
}
/* Check if First and Last usable LBA makes sense */
if (lu < fu || fu > lastlba || lu > lastlba) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"GPT->{First,Last}UsableLBA out of range"));
return NULL;
}
/* The header has to be outside usable range */
if (fu < lba && lba < lu) {
- DBG(LOWPROBE, blkid_debug("GPT header is inside usable area"));
+ DBG(LOWPROBE, ul_debug("GPT header is inside usable area"));
return NULL;
}
esz = le32_to_cpu(h->num_partition_entries) *
le32_to_cpu(h->sizeof_partition_entry);
if (!esz) {
- DBG(LOWPROBE, blkid_debug("GPT entries undefined"));
+ DBG(LOWPROBE, ul_debug("GPT entries undefined"));
return NULL;
}
*ents = (struct gpt_entry *) get_lba_buffer(pr,
le64_to_cpu(h->partition_entries_lba), esz);
if (!*ents) {
- DBG(LOWPROBE, blkid_debug("GPT entries unreadable"));
+ DBG(LOWPROBE, ul_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(LOWPROBE, blkid_debug("GPT entries corrupted"));
+ DBG(LOWPROBE, ul_debug("GPT entries corrupted"));
return NULL;
}
}
/* the partition has to inside usable range */
if (start < fu || start + size - 1 > lu) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"GPT entry[%d] overflows usable area - ignore",
i));
blkid_partlist_increment_partno(ls);
goto nothing;
if (be32_to_cpu(p->map_count) != nblks) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"mac: inconsisten map_count in partition map, "
"entry[0]: %d, entry[%d]: %d",
nblks, i - 1,
size = dos_partition_get_size(p);
if (parent && !blkid_is_nested_dimension(parent, start, size)) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: minix partition (%d) overflow "
"detected, ignore", i));
continue;
ls->next_partno = 1;
INIT_LIST_HEAD(&ls->l_tabs);
- DBG(LOWPROBE, blkid_debug("partlist reset"));
+ DBG(LOWPROBE, ul_debug("partlist reset"));
}
static blkid_partlist partitions_init_data(struct blkid_chain *chn)
reset_partlist(ls);
- DBG(LOWPROBE, blkid_debug("parts: initialized partitions list (%p, size=%d)",
+ DBG(LOWPROBE, ul_debug("parts: initialized partitions list (%p, size=%d)",
ls, ls->nparts_max));
return ls;
}
INIT_LIST_HEAD(&tab->t_tabs);
list_add_tail(&tab->t_tabs, &ls->l_tabs);
- DBG(LOWPROBE, blkid_debug("parts: create a new partition table "
+ DBG(LOWPROBE, ul_debug("parts: create a new partition table "
"(%p, type=%s, offset=%"PRId64")", tab, type, offset));
return tab;
}
par->start = start;
par->size = size;
- DBG(LOWPROBE, blkid_debug("parts: add partition (%p start=%"
+ DBG(LOWPROBE, ul_debug("parts: add partition (%p start=%"
PRId64 ", size=%" PRId64 ", table=%p)",
par, par->start, par->size, tab));
return par;
/* final check by probing function */
if (id->probefunc) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"%s: ---> call probefunc()", id->name));
rc = id->probefunc(pr, mag);
if (rc < 0) {
reset_partlist(blkid_probe_get_partlist(pr));
if (chn && !chn->binary)
blkid_probe_chain_reset_vals(pr, chn);
- DBG(LOWPROBE, blkid_debug("%s probefunc failed, rc %d",
+ DBG(LOWPROBE, ul_debug("%s probefunc failed, rc %d",
id->name, rc));
}
if (rc == BLKID_PROBE_OK && mag && chn && !chn->binary)
rc = blkid_probe_set_magic(pr, off, mag->len,
(unsigned char *) mag->magic);
- DBG(LOWPROBE, blkid_debug("%s: <--- (rc = %d)", id->name, rc));
+ DBG(LOWPROBE, ul_debug("%s: <--- (rc = %d)", id->name, rc));
}
nothing:
if (!pr->wipe_size && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_PT))
goto details_only;
- DBG(LOWPROBE, blkid_debug("--> starting probing loop [PARTS idx=%d]",
+ DBG(LOWPROBE, ul_debug("--> starting probing loop [PARTS idx=%d]",
chn->idx));
i = chn->idx < 0 ? 0 : chn->idx + 1U;
(unsigned char *) name,
strlen(name) + 1);
- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [PARTS idx=%d]",
+ DBG(LOWPROBE, ul_debug("<-- leaving probing loop (type=%s) [PARTS idx=%d]",
name, chn->idx));
rc = 0;
break;
}
if (rc != BLKID_PROBE_OK) {
- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed=%d) [PARTS idx=%d]",
+ DBG(LOWPROBE, ul_debug("<-- leaving probing loop (failed=%d) [PARTS idx=%d]",
rc, chn->idx));
}
blkid_partlist ls;
blkid_loff_t sz, off;
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"parts: ----> %s subprobe requested (parent=%p)",
id->name, parent));
off = ((blkid_loff_t) parent->start) << 9;
if (off < pr->off || pr->off + pr->size < off + sz) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"ERROR: parts: <---- '%s' subprobe: overflow detected.",
id->name));
return -ENOSPC;
blkid_free_probe(prc); /* free cloned prober */
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"parts: <---- %s subprobe done (parent=%p, rc=%d)",
id->name, parent, rc));
blkid_loff_t start, end;
int nparts, i, rc = 0;
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"=> checking if off=%jd size=%jd covered by PT",
offset, size));
blkid_partition par = &ls->parts[i];
if (par->start + par->size > (pr->size >> 9)) {
- DBG(LOWPROBE, blkid_debug("partition #%d overflows "
+ DBG(LOWPROBE, ul_debug("partition #%d overflows "
"device (off=%" PRId64 " size=%" PRId64 ")",
par->partno, par->start, par->size));
goto done;
done:
blkid_free_probe(prc);
- DBG(LOWPROBE, blkid_debug("<= %s covered by PT", rc ? "IS" : "NOT"));
+ DBG(LOWPROBE, ul_debug("<= %s covered by PT", rc ? "IS" : "NOT"));
return rc;
}
if (!ls)
return NULL;
- DBG(LOWPROBE, blkid_debug("triyng to convert devno 0x%llx to partition",
+ DBG(LOWPROBE, ul_debug("triyng to convert devno 0x%llx to partition",
(long long) devno));
if (sysfs_init(&sysfs, devno, NULL)) {
- DBG(LOWPROBE, blkid_debug("failed t init sysfs context"));
+ DBG(LOWPROBE, ul_debug("failed t init sysfs context"));
return NULL;
}
rc = sysfs_read_u64(&sysfs, "size", &size);
return NULL;
if (partno) {
- DBG(LOWPROBE, blkid_debug("mapped by DM, using partno %d", partno));
+ DBG(LOWPROBE, ul_debug("mapped by DM, using partno %d", partno));
/*
* Partition mapped by kpartx does not provide "start" offset
return NULL;
}
- DBG(LOWPROBE, blkid_debug("searching by offset/size"));
+ DBG(LOWPROBE, ul_debug("searching by offset/size"));
for (i = 0; i < ls->nparts; i++) {
blkid_partition par = &ls->parts[i];
}
- DBG(LOWPROBE, blkid_debug("not found partition for device"));
+ DBG(LOWPROBE, ul_debug("not found partition for device"));
return NULL;
}
}
if (sgi_pt_checksum(l)) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"detected corrupted sgi disk label -- ignore"));
goto nothing;
}
}
if (le32_to_cpu(l->v_version) != 1) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: unsupported solaris x86 version %d, ignore",
le32_to_cpu(l->v_version)));
goto nothing;
start += blkid_partition_get_start(parent);
if (parent && !blkid_is_nested_dimension(parent, start, size)) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: solaris partition (%d) overflow "
"detected, ignore", i));
continue;
}
if (sun_pt_checksum(l)) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"detected corrupted sun disk label -- ignore"));
goto nothing;
}
/* sectors per cylinder (partition offset is in cylinders...) */
spc = be16_to_cpu(l->nhead) * be16_to_cpu(l->nsect);
- DBG(LOWPROBE, blkid_debug("Sun VTOC sanity=%u version=%u nparts=%u",
+ DBG(LOWPROBE, ul_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)));
size = le32_to_cpu(p->nr_sects);
if (parent && !blkid_is_nested_dimension(parent, start, size)) {
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"WARNING: unixware partition (%d) overflow "
"detected, ignore", i));
continue;
if (!pr)
return NULL;
- DBG(LOWPROBE, blkid_debug("allocate a new probe %p", pr));
+ DBG(LOWPROBE, ul_debug("allocate a new probe %p", pr));
/* initialize chains */
for (i = 0; i < BLKID_NCHAINS; i++) {
if (!parent)
return NULL;
- DBG(LOWPROBE, blkid_debug("allocate a probe clone"));
+ DBG(LOWPROBE, ul_debug("allocate a probe clone"));
pr = blkid_new_probe();
if (!pr)
blkid_probe_reset_buffer(pr);
blkid_free_probe(pr->disk_probe);
- DBG(LOWPROBE, blkid_debug("free probe %p", pr));
+ DBG(LOWPROBE, ul_debug("free probe %p", pr));
free(pr);
}
if (rc != 0)
return NULL;
- DBG(LOWPROBE, blkid_debug("returning %s binary data", chn->driver->name));
+ DBG(LOWPROBE, ul_debug("returning %s binary data", chn->driver->name));
return chn->data;
}
for (i = 0; i < chn->driver->nidinfos; i++) {
const struct blkid_idinfo *id = chn->driver->idinfos[i];
- DBG(LOWPROBE, blkid_debug("%d: %s: %s",
+ DBG(LOWPROBE, ul_debug("%d: %s: %s",
i,
id->name,
blkid_bmp_get_item(chn->fltr, i)
for (i = 0; i < blkid_bmp_nwords(chn->driver->nidinfos); i++)
chn->fltr[i] = ~chn->fltr[i];
- DBG(LOWPROBE, blkid_debug("probing filter inverted"));
+ DBG(LOWPROBE, ul_debug("probing filter inverted"));
/* blkid_probe_dump_filter(pr, chain); */
return 0;
}
}
}
- DBG(LOWPROBE, blkid_debug("%s: a new probing type-filter initialized",
+ DBG(LOWPROBE, ul_debug("%s: a new probing type-filter initialized",
chn->driver->name));
/* blkid_probe_dump_filter(pr, chain); */
return 0;
list_entry(p, struct blkid_bufinfo, bufs);
if (x->off <= off && off + len <= x->off + x->len) {
- DBG(LOWPROBE, blkid_debug("\treuse buffer: off=%jd len=%jd pr=%p",
+ DBG(LOWPROBE, ul_debug("\treuse buffer: off=%jd len=%jd pr=%p",
x->off, x->len, pr));
bf = x;
break;
bf->off = off;
INIT_LIST_HEAD(&bf->bufs);
- DBG(LOWPROBE, blkid_debug("\tbuffer read: off=%jd len=%jd pr=%p",
+ DBG(LOWPROBE, ul_debug("\tbuffer read: off=%jd len=%jd pr=%p",
off, len, pr));
ret = read(pr->fd, bf->data, len);
if (ret != (ssize_t) len) {
- DBG(LOWPROBE, blkid_debug("\tbuffer read: return %zd error %m", ret));
+ DBG(LOWPROBE, ul_debug("\tbuffer read: return %zd error %m", ret));
free(bf);
if (ret >= 0)
errno = 0;
if (!pr || list_empty(&pr->buffers))
return;
- DBG(LOWPROBE, blkid_debug("reseting probing buffers pr=%p", pr));
+ DBG(LOWPROBE, ul_debug("reseting probing buffers pr=%p", pr));
while (!list_empty(&pr->buffers)) {
struct blkid_bufinfo *bf = list_entry(pr->buffers.next,
free(bf);
}
- DBG(LOWPROBE, blkid_debug("buffers summary: %"PRIu64" bytes "
+ DBG(LOWPROBE, ul_debug("buffers summary: %"PRIu64" bytes "
"by %"PRIu64" read() call(s)",
len_ct, read_ct));
else {
if (S_ISBLK(sb.st_mode)) {
if (blkdev_get_size(fd, (unsigned long long *) &pr->size)) {
- DBG(LOWPROBE, blkid_debug("failed to get device size"));
+ DBG(LOWPROBE, ul_debug("failed to get device size"));
goto err;
}
} else if (S_ISCHR(sb.st_mode))
pr->flags |= BLKID_FL_CDROM_DEV;
#endif
- DBG(LOWPROBE, blkid_debug("ready for low-probing, offset=%jd, size=%jd",
+ DBG(LOWPROBE, ul_debug("ready for low-probing, offset=%jd, size=%jd",
pr->off, pr->size));
- DBG(LOWPROBE, blkid_debug("whole-disk: %s, regfile: %s",
+ DBG(LOWPROBE, ul_debug("whole-disk: %s, regfile: %s",
blkid_probe_is_wholedisk(pr) ?"YES" : "NO",
S_ISREG(pr->mode) ? "YES" : "NO"));
return 0;
err:
- DBG(LOWPROBE, blkid_debug("failed to prepare a device for low-probing"));
+ DBG(LOWPROBE, ul_debug("failed to prepare a device for low-probing"));
return -1;
}
if (!pr)
return -1;
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"changing probing area pr=%p: size=%llu, off=%llu "
"-to-> size=%llu, off=%llu",
pr,
return -errno;
if (buf && !memcmp(mag->magic,
buf + (mag->sboff & 0x3ff), mag->len)) {
- DBG(LOWPROBE, blkid_debug("\tmagic sboff=%u, kboff=%ld",
+ DBG(LOWPROBE, ul_debug("\tmagic sboff=%u, kboff=%ld",
mag->sboff, mag->kboff));
if (offset)
*offset = off + (mag->sboff & 0x3ff);
static inline void blkid_probe_start(blkid_probe pr)
{
if (pr) {
- DBG(LOWPROBE, blkid_debug("%p: start probe", pr));
+ DBG(LOWPROBE, ul_debug("%p: start probe", pr));
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
static inline void blkid_probe_end(blkid_probe pr)
{
if (pr) {
- DBG(LOWPROBE, blkid_debug("%p: end probe", pr));
+ DBG(LOWPROBE, ul_debug("%p: end probe", pr));
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
chn->binary = FALSE; /* for sure... */
- DBG(LOWPROBE, blkid_debug("chain probe %s %s (idx=%d)",
+ DBG(LOWPROBE, ul_debug("chain probe %s %s (idx=%d)",
chn->driver->name,
chn->enabled? "ENABLED" : "DISABLED",
chn->idx));
if (len > sizeof(buf))
len = sizeof(buf);
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"do_wipe [offset=0x%jx, len=%zd, chain=%s, idx=%d, dryrun=%s]\n",
offset, len, chn->driver->name, chn->idx, dryrun ? "yes" : "not"));
if (chn->idx >= 0) {
chn->idx--;
- DBG(LOWPROBE, blkid_debug("step back: moving %s chain index to %d",
+ DBG(LOWPROBE, ul_debug("step back: moving %s chain index to %d",
chn->driver->name,
chn->idx));
}
*/
size_t idx = chn->driver->id > 0 ? chn->driver->id - 1 : 0;
- DBG(LOWPROBE, blkid_debug("step back: moving to previous chain"));
+ DBG(LOWPROBE, ul_debug("step back: moving to previous chain"));
if (idx > 0)
pr->cur_chain = &pr->chains[idx];
chn = pr->cur_chain = &pr->chains[i];
chn->binary = FALSE; /* for sure... */
- DBG(LOWPROBE, blkid_debug("chain safeprobe %s %s",
+ DBG(LOWPROBE, ul_debug("chain safeprobe %s %s",
chn->driver->name,
chn->enabled? "ENABLED" : "DISABLED"));
chn = pr->cur_chain = &pr->chains[i];
chn->binary = FALSE; /* for sure... */
- DBG(LOWPROBE, blkid_debug("chain fullprobe %s: %s",
+ DBG(LOWPROBE, ul_debug("chain fullprobe %s: %s",
chn->driver->name,
chn->enabled? "ENABLED" : "DISABLED"));
v->chain = pr->cur_chain;
pr->nvals++;
- DBG(LOWPROBE, blkid_debug("assigning %s [%s]", name, v->chain->driver->name));
+ DBG(LOWPROBE, ul_debug("assigning %s [%s]", name, v->chain->driver->name));
return v;
}
v = &pr->vals[pr->nvals - 1];
- DBG(LOWPROBE, blkid_debug("un-assigning %s [%s]", v->name, v->chain->driver->name));
+ DBG(LOWPROBE, ul_debug("un-assigning %s [%s]", v->name, v->chain->driver->name));
memset(v, 0, sizeof(struct blkid_prval));
pr->nvals--;
if (csum != expected) {
struct blkid_chain *chn = blkid_probe_get_chain(pr);
- DBG(LOWPROBE, blkid_debug(
+ DBG(LOWPROBE, ul_debug(
"incorrect checksum for type %s,"
" got %jX, expected %jX",
blkid_probe_get_probername(pr),
if (!disk_path)
return NULL;
- DBG(LOWPROBE, blkid_debug("allocate a wholedisk probe"));
+ DBG(LOWPROBE, ul_debug("allocate a wholedisk probe"));
pr->disk_probe = blkid_new_probe_from_filename(disk_path);
if (len)
*len = v->len;
- DBG(LOWPROBE, blkid_debug("returning %s value", v->name));
+ DBG(LOWPROBE, ul_debug("returning %s value", v->name));
return 0;
}
struct blkid_prval *v = &pr->vals[i];
if (v->name && strcmp(name, v->name) == 0) {
- DBG(LOWPROBE, blkid_debug("returning %s value", v->name));
+ DBG(LOWPROBE, ul_debug("returning %s value", v->name));
return v;
}
}
return;
if (!size) {
- DBG(LOWPROBE, blkid_debug("zeroize wiper"));
+ DBG(LOWPROBE, ul_debug("zeroize wiper"));
pr->wipe_size = pr->wipe_off = 0;
pr->wipe_chain = NULL;
return;
pr->wipe_chain = chn;
DBG(LOWPROBE,
- blkid_debug("wiper set to %s::%s off=%jd size=%jd",
+ ul_debug("wiper set to %s::%s off=%jd size=%jd",
chn->driver->name,
chn->driver->idinfos[chn->idx]->name,
pr->wipe_off, pr->wipe_size));
struct blkid_chain *chn = NULL;
if (blkid_probe_is_wiped(pr, &chn, off, size) && chn) {
- DBG(LOWPROBE, blkid_debug("previously wiped area modified "
+ DBG(LOWPROBE, ul_debug("previously wiped area modified "
" -- ignore previous results"));
blkid_probe_set_wiper(pr, 0, 0);
blkid_probe_chain_reset_vals(pr, chn);
return 0;
if (!strncmp(p, "<device", 7)) {
- DBG(READ, blkid_debug("found device header: %8s", p));
+ DBG(READ, ul_debug("found device header: %8s", p));
p += 7;
*cp = p;
*cp = skip_over_blank(*cp);
if (!strncmp(*cp, "</device>", 9)) {
- DBG(READ, blkid_debug("found device trailer %9s", *cp));
+ DBG(READ, ul_debug("found device trailer %9s", *cp));
*cp += 9;
return 0;
}
start = tmp = strchr(*cp, '>');
if (!start) {
- DBG(READ, blkid_debug("blkid: short line parsing dev: %s", *cp));
+ DBG(READ, ul_debug("blkid: short line parsing dev: %s", *cp));
return -BLKID_ERR_CACHE;
}
start = skip_over_blank(start + 1);
end = skip_over_word(start);
- DBG(READ, blkid_debug("device should be %*s",
+ DBG(READ, ul_debug("device should be %*s",
(int)(end - start), start));
if (**cp == '>')
*tmp = '\0';
if (!(tmp = strrchr(end, '<')) || parse_end(&tmp) < 0) {
- DBG(READ, blkid_debug("blkid: missing </device> ending: %s", end));
+ DBG(READ, ul_debug("blkid: missing </device> ending: %s", end));
} else if (tmp)
*tmp = '\0';
if (end - start <= 1) {
- DBG(READ, blkid_debug("blkid: empty device name: %s", *cp));
+ DBG(READ, ul_debug("blkid: empty device name: %s", *cp));
return -BLKID_ERR_CACHE;
}
if (name == NULL)
return -BLKID_ERR_MEM;
- DBG(READ, blkid_debug("found dev %s", name));
+ DBG(READ, ul_debug("found dev %s", name));
if (!(*dev = blkid_get_dev(cache, name, BLKID_DEV_CREATE))) {
free(name);
if (**value == '"') {
end = strchr(*value + 1, '"');
if (!end) {
- DBG(READ, blkid_debug("unbalanced quotes at: %s", *value));
+ DBG(READ, ul_debug("unbalanced quotes at: %s", *value));
*cp = *value;
return -BLKID_ERR_CACHE;
}
} else
ret = blkid_set_tag(dev, name, value, strlen(value));
- DBG(READ, blkid_debug(" tag: %s=\"%s\"", name, value));
+ DBG(READ, ul_debug(" tag: %s=\"%s\"", name, value));
return ret < 0 ? ret : 1;
}
*dev_p = NULL;
- DBG(READ, blkid_debug("line: %s", cp));
+ DBG(READ, ul_debug("line: %s", cp));
if ((ret = parse_dev(cache, dev_p, &cp)) <= 0)
return ret;
}
if (dev->bid_type == NULL) {
- DBG(READ, blkid_debug("blkid: device %s has no TYPE",dev->bid_name));
+ DBG(READ, ul_debug("blkid: device %s has no TYPE",dev->bid_name));
blkid_free_dev(dev);
goto done;
}
goto errout;
if ((st.st_mtime == cache->bic_ftime) ||
(cache->bic_flags & BLKID_BIC_FL_CHANGED)) {
- DBG(CACHE, blkid_debug("skipping re-read of %s",
+ DBG(CACHE, ul_debug("skipping re-read of %s",
cache->bic_filename));
goto errout;
}
- DBG(CACHE, blkid_debug("reading cache file %s",
+ DBG(CACHE, ul_debug("reading cache file %s",
cache->bic_filename));
file = fdopen(fd, "r" UL_CLOEXECSTR);
}
if (blkid_parse_line(cache, &dev, buf) < 0) {
- DBG(READ, blkid_debug("blkid: bad format on line %d", lineno));
+ DBG(READ, ul_debug("blkid: bad format on line %d", lineno));
continue;
}
}
blkid_cache c = cache;
char *ret = NULL;
- DBG(RESOLVE, blkid_debug("looking for %s on %s", tagname, devname));
+ DBG(RESOLVE, ul_debug("looking for %s on %s", tagname, devname));
if (!devname)
return NULL;
if (!cache && blkid_get_cache(&c, NULL) < 0)
return NULL;
- DBG(RESOLVE, blkid_debug("looking for %s%s%s %s", token, value ? "=" : "",
+ DBG(RESOLVE, ul_debug("looking for %s%s%s %s", token, value ? "=" : "",
value ? value : "", cache ? "in cache" : "from disk"));
if (!value) {
if (!dev || dev->bid_name[0] != '/')
return 0;
- DBG(SAVE, blkid_debug("device %s, type %s", dev->bid_name, dev->bid_type ?
+ DBG(SAVE, ul_debug("device %s, type %s", dev->bid_name, dev->bid_type ?
dev->bid_type : "(null)"));
fprintf(file, "<device DEVNO=\"0x%04lx\" TIME=\"%ld.%ld\"",
if (list_empty(&cache->bic_devs) ||
!(cache->bic_flags & BLKID_BIC_FL_CHANGED)) {
- DBG(SAVE, blkid_debug("skipping cache file write"));
+ DBG(SAVE, ul_debug("skipping cache file write"));
return 0;
}
S_IRUSR|S_IRGRP|S_IROTH|
S_IXUSR|S_IXGRP|S_IXOTH) != 0
&& errno != EEXIST) {
- DBG(SAVE, blkid_debug("can't create %s directory for cache file",
+ DBG(SAVE, ul_debug("can't create %s directory for cache file",
BLKID_RUNTIME_DIR));
return 0;
}
/* If we can't write to the cache file, then don't even try */
if (((ret = stat(filename, &st)) < 0 && errno != ENOENT) ||
(ret == 0 && access(filename, W_OK) < 0)) {
- DBG(SAVE, blkid_debug("can't write to cache file %s", filename));
+ DBG(SAVE, ul_debug("can't write to cache file %s", filename));
return 0;
}
fd = mkostemp(tmp, O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC);
if (fd >= 0) {
if (fchmod(fd, 0644) != 0)
- DBG(SAVE, blkid_debug("%s: fchmod failed", filename));
+ DBG(SAVE, ul_debug("%s: fchmod failed", filename));
else if ((file = fdopen(fd, "w" UL_CLOEXECSTR)))
opened = tmp;
if (!file)
opened = filename;
}
- DBG(SAVE, blkid_debug("writing cache file %s (really %s)",
+ DBG(SAVE, ul_debug("writing cache file %s (really %s)",
filename, opened));
if (!file) {
}
if (close_stream(file) != 0)
- DBG(SAVE, blkid_debug("write failed: %s", filename));
+ DBG(SAVE, ul_debug("write failed: %s", filename));
if (opened != filename) {
if (ret < 0) {
unlink(opened);
- DBG(SAVE, blkid_debug("unlinked temp cache %s", opened));
+ DBG(SAVE, ul_debug("unlinked temp cache %s", opened));
} else {
char *backup;
sprintf(backup, "%s.old", filename);
unlink(backup);
if (link(filename, backup)) {
- DBG(SAVE, blkid_debug("can't link %s to %s",
+ DBG(SAVE, ul_debug("can't link %s to %s",
filename, backup));
}
free(backup);
}
if (rename(opened, filename)) {
ret = errno;
- DBG(SAVE, blkid_debug("can't rename %s to %s",
+ DBG(SAVE, ul_debug("can't rename %s to %s",
opened, filename));
} else {
- DBG(SAVE, blkid_debug("moved temp cache %s", opened));
+ DBG(SAVE, ul_debug("moved temp cache %s", opened));
}
}
}
{
struct blkid_chain *chn = blkid_probe_get_chain(pr);
- DBG(PROBE, blkid_debug("ext2_sb.compat = %08X:%08X:%08X",
+ DBG(PROBE, ul_debug("ext2_sb.compat = %08X:%08X:%08X",
le32_to_cpu(es->s_feature_compat),
le32_to_cpu(es->s_feature_incompat),
le32_to_cpu(es->s_feature_ro_compat)));
if (!version)
return -1;
- DBG(LOWPROBE, blkid_debug("minix version %d detected [%s]", version,
+ DBG(LOWPROBE, ul_debug("minix version %d detected [%s]", version,
#if defined(WORDS_BIGENDIAN)
*other_endian ? "LE" : "BE"
#else
le64_to_cpu(sbb->s_last_cno));
sb = swp ? sbb : sbp;
- DBG(LOWPROBE, blkid_debug("nilfs2: primary=%d, backup=%d, swap=%d",
+ DBG(LOWPROBE, ul_debug("nilfs2: primary=%d, backup=%d, swap=%d",
valid[0], valid[1], swp));
if (strlen(sb->s_volume_name))
off = le64_to_cpu(ns->mft_cluster_location) * sector_size *
sectors_per_cluster;
- DBG(LOWPROBE, blkid_debug("NTFS: sector_size=%d, mft_record_size=%d, "
+ DBG(LOWPROBE, ul_debug("NTFS: sector_size=%d, mft_record_size=%d, "
"sectors_per_cluster=%d, nr_clusters=%ju "
"cluster_offset=%jd",
(int) sector_size, mft_record_size,
} else if (flag & BLKID_FLTR_ONLYIN)
blkid_bmp_set_item(chn->fltr, i);
}
- DBG(LOWPROBE, blkid_debug("a new probing usage-filter initialized"));
+ DBG(LOWPROBE, ul_debug("a new probing usage-filter initialized"));
return 0;
}
return -EINVAL;
blkid_probe_chain_reset_vals(pr, chn);
- DBG(LOWPROBE, blkid_debug("--> starting probing loop [SUBLKS idx=%d]",
+ DBG(LOWPROBE, ul_debug("--> starting probing loop [SUBLKS idx=%d]",
chn->idx));
if (pr->size <= 0 || (pr->size <= 1024 && !S_ISCHR(pr->mode)))
id = idinfos[i];
if (chn->fltr && blkid_bmp_get_item(chn->fltr, i)) {
- DBG(LOWPROBE, blkid_debug("filter out: %s", id->name));
+ DBG(LOWPROBE, ul_debug("filter out: %s", id->name));
rc = BLKID_PROBE_NONE;
continue;
}
continue;
}
- DBG(LOWPROBE, blkid_debug("[%zd] %s:", i, id->name));
+ DBG(LOWPROBE, ul_debug("[%zd] %s:", i, id->name));
rc = blkid_probe_get_idmag(pr, id, &off, &mag);
if (rc < 0)
/* final check by probing function */
if (id->probefunc) {
- DBG(LOWPROBE, blkid_debug("\tcall probefunc()"));
+ DBG(LOWPROBE, ul_debug("\tcall probefunc()"));
rc = id->probefunc(pr, mag);
if (rc != BLKID_PROBE_OK) {
blkid_probe_chain_reset_vals(pr, chn);
(unsigned char *) mag->magic);
if (rc) {
blkid_probe_chain_reset_vals(pr, chn);
- DBG(LOWPROBE, blkid_debug("failed to set result -- ingnore"));
+ DBG(LOWPROBE, ul_debug("failed to set result -- ingnore"));
continue;
}
- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [SUBLKS idx=%d]",
+ DBG(LOWPROBE, ul_debug("<-- leaving probing loop (type=%s) [SUBLKS idx=%d]",
id->name, chn->idx));
return BLKID_PROBE_OK;
}
nothing:
- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed=%d) [SUBLKS idx=%d]",
+ DBG(LOWPROBE, ul_debug("<-- leaving probing loop (failed=%d) [SUBLKS idx=%d]",
rc, chn->idx));
return rc;
}
return rc; /* error */
if (count > 1 && intol) {
- DBG(LOWPROBE, blkid_debug("ERROR: superblocks chain: "
+ DBG(LOWPROBE, ul_debug("ERROR: superblocks chain: "
"ambivalent result detected (%d filesystems)!",
count));
return -2; /* error, ambivalent result (more FS) */
/* SWAPSPACE2 - check for wrong version or zeroed pagecount */
if (strcmp(version, "1") == 0) {
if (hdr->version != 1 && swab32(hdr->version) != 1) {
- DBG(LOWPROBE, blkid_debug("incorrect swap version"));
+ DBG(LOWPROBE, ul_debug("incorrect swap version"));
return 1;
}
if (hdr->lastpage == 0) {
- DBG(LOWPROBE, blkid_debug("not set last swap page"));
+ DBG(LOWPROBE, ul_debug("not set last swap page"));
return 1;
}
}
struct vfat_dir_entry *ent, *dir = NULL;
uint32_t i;
- DBG(LOWPROBE, blkid_debug("\tlook for label in root-dir "
+ DBG(LOWPROBE, ul_debug("\tlook for label in root-dir "
"(entries: %d, offset: %jd)", entries, offset));
if (!blkid_probe_is_tiny(pr)) {
if ((ent->attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) ==
FAT_ATTR_VOLUME_ID) {
- DBG(LOWPROBE, blkid_debug("\tfound fs LABEL at entry %d", i));
+ DBG(LOWPROBE, ul_debug("\tfound fs LABEL at entry %d", i));
return ent->name;
}
}
return tag;
}
-#ifdef CONFIG_BLKID_DEBUG
void blkid_debug_dump_tag(blkid_tag tag)
{
if (!tag) {
fprintf(stderr, " tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
}
-#endif
void blkid_free_tag(blkid_tag tag)
{
if (!tag)
return;
- DBG(TAG, blkid_debug(" freeing tag %s=%s", tag->bit_name,
+ DBG(TAG, ul_debug(" freeing tag %s=%s", tag->bit_name,
tag->bit_val ? tag->bit_val : "(NULL)"));
DBG(TAG, blkid_debug_dump_tag(tag));
list_for_each(p, &cache->bic_tags) {
tmp = list_entry(p, struct blkid_struct_tag, bit_tags);
if (!strcmp(tmp->bit_name, type)) {
- DBG(TAG, blkid_debug(" found cache tag head %s", type));
+ DBG(TAG, ul_debug(" found cache tag head %s", type));
head = tmp;
break;
}
if (!head)
goto errout;
- DBG(TAG, blkid_debug(" creating new cache tag head %s", name));
+ DBG(TAG, ul_debug(" creating new cache tag head %s", name));
head->bit_name = name ? strdup(name) : NULL;
if (!head->bit_name)
goto errout;
{
char *name, *value, *cp;
- DBG(TAG, blkid_debug("trying to parse '%s' as a tag", token));
+ DBG(TAG, ul_debug("trying to parse '%s' as a tag", token));
if (!token || !(cp = strchr(token, '=')))
return -1;
return 0;
errout:
- DBG(TAG, blkid_debug("parse error: '%s'", token));
+ DBG(TAG, ul_debug("parse error: '%s'", token));
free(name);
return -1;
}
blkid_read_cache(cache);
- DBG(TAG, blkid_debug("looking for %s=%s in cache", type, value));
+ DBG(TAG, ul_debug("looking for %s=%s in cache", type, value));
try_again:
pri = -1;
if (!cmd)
goto nothing;
if (pipe(dmpipe) < 0) {
- DBG(LOWPROBE, blkid_debug("Failed to open pipe: errno=%d", errno));
+ DBG(LOWPROBE, ul_debug("Failed to open pipe: errno=%d", errno));
goto nothing;
}
execv(dmargv[0], dmargv);
- DBG(LOWPROBE, blkid_debug("Failed to execute %s: errno=%d", cmd, errno));
+ DBG(LOWPROBE, ul_debug("Failed to execute %s: errno=%d", cmd, errno));
exit(1);
}
case -1:
- DBG(LOWPROBE, blkid_debug("Failed to forking: errno=%d", errno));
+ DBG(LOWPROBE, ul_debug("Failed to forking: errno=%d", errno));
goto nothing;
default:
break;
goto nothing;
if (pipe(lvpipe) < 0) {
- DBG(LOWPROBE, blkid_debug("Failed to open pipe: errno=%d", errno));
+ DBG(LOWPROBE, ul_debug("Failed to open pipe: errno=%d", errno));
goto nothing;
}
execv(lvargv[0], lvargv);
- DBG(LOWPROBE, blkid_debug("Failed to execute %s: errno=%d", cmd, errno));
+ DBG(LOWPROBE, ul_debug("Failed to execute %s: errno=%d", cmd, errno));
exit(1);
}
case -1:
- DBG(LOWPROBE, blkid_debug("Failed to forking: errno=%d", errno));
+ DBG(LOWPROBE, ul_debug("Failed to forking: errno=%d", errno));
goto nothing;
default:
break;
return -1; /* nothing, works with block devices only */
if (chn->binary) {
- DBG(LOWPROBE, blkid_debug("initialize topology binary data"));
+ DBG(LOWPROBE, ul_debug("initialize topology binary data"));
if (chn->data)
/* reset binary data */
blkid_probe_chain_reset_vals(pr, chn);
- DBG(LOWPROBE, blkid_debug("--> starting probing loop [TOPOLOGY idx=%d]",
+ DBG(LOWPROBE, ul_debug("--> starting probing loop [TOPOLOGY idx=%d]",
chn->idx));
i = chn->idx < 0 ? 0 : chn->idx + 1U;
chn->idx = i;
if (id->probefunc) {
- DBG(LOWPROBE, blkid_debug("%s: call probefunc()", id->name));
+ DBG(LOWPROBE, ul_debug("%s: call probefunc()", id->name));
if (id->probefunc(pr, NULL) != 0)
continue;
}
/* generic for all probing drivers */
topology_set_logical_sector_size(pr);
- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (type=%s) [TOPOLOGY idx=%d]",
+ DBG(LOWPROBE, ul_debug("<-- leaving probing loop (type=%s) [TOPOLOGY idx=%d]",
id->name, chn->idx));
return 0;
}
- DBG(LOWPROBE, blkid_debug("<-- leaving probing loop (failed) [TOPOLOGY idx=%d]",
+ DBG(LOWPROBE, ul_debug("<-- leaving probing loop (failed) [TOPOLOGY idx=%d]",
chn->idx));
return 1;
}
diff = now - dev->bid_time;
if (stat(dev->bid_name, &st) < 0) {
- DBG(PROBE, blkid_debug("blkid_verify: error %m (%d) while "
+ DBG(PROBE, ul_debug("blkid_verify: error %m (%d) while "
"trying to stat %s", errno,
dev->bid_name));
open_err:
if ((errno == EPERM) || (errno == EACCES) || (errno == ENOENT)) {
/* We don't have read permission, just return cache data. */
- DBG(PROBE, blkid_debug("returning unverified data for %s",
+ DBG(PROBE, ul_debug("returning unverified data for %s",
dev->bid_name));
return dev;
}
return dev;
#ifndef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
- DBG(PROBE, blkid_debug("need to revalidate %s (cache time %lu, stat time %lu,\t"
+ DBG(PROBE, ul_debug("need to revalidate %s (cache time %lu, stat time %lu,\t"
"time since last check %lu)",
dev->bid_name, (unsigned long)dev->bid_time,
(unsigned long)st.st_mtime, (unsigned long)diff));
#else
- DBG(PROBE, blkid_debug("need to revalidate %s (cache time %lu.%lu, stat time %lu.%lu,\t"
+ DBG(PROBE, ul_debug("need to revalidate %s (cache time %lu.%lu, stat time %lu.%lu,\t"
"time since last check %lu)",
dev->bid_name,
(unsigned long)dev->bid_time, (unsigned long)dev->bid_utime,
fd = open(dev->bid_name, O_RDONLY|O_CLOEXEC);
if (fd < 0) {
- DBG(PROBE, blkid_debug("blkid_verify: error %m (%d) while "
+ DBG(PROBE, ul_debug("blkid_verify: error %m (%d) while "
"opening %s", errno,
dev->bid_name));
goto open_err;
blkid_probe_to_tags(cache->probe, dev);
- DBG(PROBE, blkid_debug("%s: devno 0x%04llx, type %s",
+ DBG(PROBE, ul_debug("%s: devno 0x%04llx, type %s",
dev->bid_name, (long long)st.st_rdev, dev->bid_type));
}