Output the power mode with the attr: tag like other attributes

This commit is contained in:
Andrea Mazzoleni 2025-12-21 17:31:35 +01:00
parent efcdfb9118
commit 67e4896671
5 changed files with 113 additions and 103 deletions

View file

@ -2661,14 +2661,17 @@ retry:
}
if (ret == 0) {
log_tag("device:%s:%s:active\n", file, name);
log_tag("attr:%s:%s:power:active\n", file, name);
*power = POWER_ACTIVE;
} else if (ret == 3) {
log_tag("device:%s:%s:standby\n", file, name);
log_tag("attr:%s:%s:power:standby\n", file, name);
*power = POWER_STANDBY;
} else {
log_tag("device:%s:%s:unknown\n", file, name);
*power = POWER_UNKNOWN;
/* LCOV_EXCL_START */
log_tag("device:%s:%s:exit:%d\n", file, name, ret);
log_fatal("Failed to run '%s' with return code %xh.\n", u16tou8(conv_buf, cmd), ret);
return -1;
/* LCOV_EXCL_STOP */
}
return 0;
@ -2758,7 +2761,7 @@ retry:
/* LCOV_EXCL_STOP */
}
log_tag("device:%s:%s:down\n", file, name);
log_tag("attr:%s:%s:power:down\n", file, name);
return 0;
}
@ -2841,7 +2844,7 @@ static int devup(uint64_t device, const char* name, const char* wfile)
VirtualFree(buffer, 0, MEM_RELEASE);
log_tag("device:%s:%s:up\n", file, name);
log_tag("attr:%s:%s:power:up\n", file, name);
return 0;
}

View file

@ -1221,7 +1221,7 @@ static int devsmart(dev_t device, const char* name, const char* smartctl, uint64
if (!WIFEXITED(ret)) {
/* LCOV_EXCL_START */
log_tag("device:%s:%s:error:abort\n", file, name);
log_tag("device:%s:%s:abort\n", file, name);
log_fatal("Failed to run '%s' (not exited).\n", cmd);
return -1;
/* LCOV_EXCL_STOP */
@ -1314,11 +1314,12 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, int* p
return -1;
/* LCOV_EXCL_STOP */
}
if (WEXITSTATUS(ret) == 0) {
log_tag("device:%s:%s:active\n", file, name);
log_tag("attr:%s:%s:power:active\n", file, name);
*power = POWER_ACTIVE;
} else if (WEXITSTATUS(ret) == 3) {
log_tag("device:%s:%s:standby\n", file, name);
log_tag("attr:%s:%s:power:standby\n", file, name);
*power = POWER_STANDBY;
} else {
/* LCOV_EXCL_START */
@ -1413,7 +1414,7 @@ static int devdown(dev_t device, const char* name, const char* smartctl)
/* LCOV_EXCL_STOP */
}
log_tag("device:%s:%s:down\n", file, name);
log_tag("attr:%s:%s:power:down\n", file, name);
return 0;
}
@ -1494,7 +1495,7 @@ static int devup(dev_t device, const char* name)
/* LCOV_EXCL_STOP */
}
log_tag("device:%s:%s:up\n", file, name);
log_tag("attr:%s:%s:power:up\n", file, name);
free(buf);
return 0;