mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 12:57:14 -05:00
Log more information during UUID detection
This commit is contained in:
parent
62e4b7e14c
commit
ecff017ffe
1 changed files with 11 additions and 5 deletions
|
|
@ -92,7 +92,7 @@ static int devuuid_dev(uint64_t device, char* uuid, size_t uuid_size)
|
||||||
/* scan the UUID directory searching for the device */
|
/* scan the UUID directory searching for the device */
|
||||||
d = opendir("/dev/disk/by-uuid");
|
d = opendir("/dev/disk/by-uuid");
|
||||||
if (!d) {
|
if (!d) {
|
||||||
log_tag("uuid:by-uuidd:%u:%u: opendir(/dev/disk/by-uuid) failed\n", major(device), minor(device));
|
log_tag("uuid:by-uuidd:%u:%u: opendir(/dev/disk/by-uuid) failed, %s\n", major(device), minor(device), strerror(errno));
|
||||||
/* directory missing?, likely we are not in Linux */
|
/* directory missing?, likely we are not in Linux */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ static int devuuid_dev(uint64_t device, char* uuid, size_t uuid_size)
|
||||||
|
|
||||||
ret = fstatat(dirfd(d), dd->d_name, &st, 0);
|
ret = fstatat(dirfd(d), dd->d_name, &st, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
log_tag("uuid:by-uuidd:%u:%u: fstatat(%s) failed\n", major(device), minor(device), dd->d_name);
|
log_tag("uuid:by-uuidd:%u:%u: fstatat(%s) failed, %s\n", major(device), minor(device), dd->d_name, strerror(errno));
|
||||||
/* generic error, ignore and continue the search */
|
/* generic error, ignore and continue the search */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +118,7 @@ static int devuuid_dev(uint64_t device, char* uuid, size_t uuid_size)
|
||||||
pathprint(path, sizeof(path), "/dev/disk/by-uuid/%s", dd->d_name);
|
pathprint(path, sizeof(path), "/dev/disk/by-uuid/%s", dd->d_name);
|
||||||
ret = readlink(path, buf, sizeof(buf));
|
ret = readlink(path, buf, sizeof(buf));
|
||||||
if (ret < 0 || ret == sizeof(buf)) {
|
if (ret < 0 || ret == sizeof(buf)) {
|
||||||
log_tag("uuid:by-uuidd:%u:%u: readlink(/dev/disk/by-uuid/%s) failed\n", major(device), minor(device), dd->d_name);
|
log_tag("uuid:by-uuidd:%u:%u: readlink(/dev/disk/by-uuid/%s) failed, %s\n", major(device), minor(device), dd->d_name, strerror(errno));
|
||||||
/* generic error, ignore and continue the search */
|
/* generic error, ignore and continue the search */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -134,6 +134,8 @@ static int devuuid_dev(uint64_t device, char* uuid, size_t uuid_size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_tag("uuid:by-uuidd:%u:%u: /dev/disk/by-uuid doesn't contain a matching block device\n", major(device), minor(device));
|
||||||
|
|
||||||
/* not found */
|
/* not found */
|
||||||
closedir(d);
|
closedir(d);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -156,14 +158,14 @@ static int devuuid_blkid(uint64_t device, char* uuid, size_t uuid_size)
|
||||||
|
|
||||||
devname = blkid_devno_to_devname(device);
|
devname = blkid_devno_to_devname(device);
|
||||||
if (!devname) {
|
if (!devname) {
|
||||||
log_tag("uuid:blkid:%u:%u: blkid_devno_to_devname() failed\n", major(device), minor(device));
|
log_tag("uuid:blkid:%u:%u: blkid_devno_to_devname() failed, %s\n", major(device), minor(device), strerror(errno));
|
||||||
/* device mapping failed */
|
/* device mapping failed */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uuidname = blkid_get_tag_value(cache, "UUID", devname);
|
uuidname = blkid_get_tag_value(cache, "UUID", devname);
|
||||||
if (!uuidname) {
|
if (!uuidname) {
|
||||||
log_tag("uuid:blkid:%u:%u: blkid_get_tag_value(%s) failed\n", major(device), minor(device), devname);
|
log_tag("uuid:blkid:%u:%u: blkid_get_tag_value(UUID,%s) failed, %s\n", major(device), minor(device), devname, strerror(errno));
|
||||||
/* uuid mapping failed */
|
/* uuid mapping failed */
|
||||||
free(devname);
|
free(devname);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -185,12 +187,16 @@ int devuuid(uint64_t device, char* uuid, size_t uuid_size)
|
||||||
#if HAVE_FSTATAT
|
#if HAVE_FSTATAT
|
||||||
if (devuuid_dev(device, uuid, uuid_size) == 0)
|
if (devuuid_dev(device, uuid, uuid_size) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
log_tag("uuid:by-uuidd:%u:%u: by-uuid not supported\n", major(device), minor(device));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* fall back to blkid for other cases */
|
/* fall back to blkid for other cases */
|
||||||
#if HAVE_BLKID
|
#if HAVE_BLKID
|
||||||
if (devuuid_blkid(device, uuid, uuid_size) == 0)
|
if (devuuid_blkid(device, uuid, uuid_size) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
log_tag("uuid:blkid:%u:%u: blkid not supported\n", major(device), minor(device));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
log_tag("uuid:notfound:%u:%u:\n", major(device), minor(device));
|
log_tag("uuid:notfound:%u:%u:\n", major(device), minor(device));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue