Adjust UUID printing in the log

This commit is contained in:
Andrea Mazzoleni 2015-12-11 18:59:24 +01:00
parent 5541f8d5e6
commit f8214de959
2 changed files with 10 additions and 7 deletions

View file

@ -1537,9 +1537,10 @@ int windows_readlink(const char* file, char* buffer, size_t size)
int devuuid(uint64_t device, char* uuid, size_t uuid_size)
{
/* just use the volume serial number returned in the device parameter */
log_tag("uuid:windows:%08x:%u:\n", (unsigned)device, (unsigned)device);
snprintf(uuid, uuid_size, "%08x", (unsigned)device);
log_tag("uuid:windows:%u:%s:\n", (unsigned)device, uuid);
return 0;
}

View file

@ -107,12 +107,13 @@ static int devuuid_dev(uint64_t device, char* uuid, size_t uuid_size)
continue;
}
log_tag("uuid:dev:%s:%u:%u:\n", dd->d_name, major(st.st_rdev), minor(st.st_rdev));
/* if it matches, we have the uuid */
if (S_ISBLK(st.st_mode) && st.st_rdev == (dev_t)device) {
/* found */
pathcpy(uuid, uuid_size, dd->d_name);
log_tag("uuid:dev:%u:%u:%s:\n", major(device), minor(device), uuid);
closedir(d);
return 0;
}
@ -151,10 +152,10 @@ static int devuuid_blkid(uint64_t device, char* uuid, size_t uuid_size)
return -1;
}
log_tag("uuid:blkid:%s:%u:%u:\n", uuidname, major(device), minor(device));
pathcpy(uuid, uuid_size, uuidname);
log_tag("uuid:dev:%u:%u:%s:\n", major(device), minor(device), uuid);
free(devname);
free(uuidname);
return 0;
@ -175,8 +176,9 @@ int devuuid(uint64_t device, char* uuid, size_t uuid_size)
return 0;
#endif
log_tag("uuid:notfound:%u:%u:\n", major(device), minor(device));
/* not supported */
(void)device;
(void)uuid;
(void)uuid_size;
return -1;