Add support for specifying case-insensitive SMART attribute names in the smartignore option

This commit is contained in:
Andrea Mazzoleni 2026-06-25 22:52:53 +02:00
parent a6aa723b08
commit 82fdb5663d
51 changed files with 624 additions and 231 deletions

View file

@ -533,14 +533,37 @@ static void state_info_log(devinfo_t* devinfo)
log_tag("attr:%s:%s:rotationrate:%" PRIu64 "\n", devinfo->file, devinfo->name, devinfo->info[INFO_ROTATION_RATE]);
}
static void state_smart_ignore(struct snapraid_state* state, devinfo_t* devinfo)
void state_smart_ignore(struct snapraid_state* state, devinfo_t* devinfo)
{
int i, j;
/* clear attributes to ignore */
for (int i = 0; i < SMART_IGNORE_MAX; ++i) {
if (state->smartignore[i] < 256)
devinfo->smart[state->smartignore[i]].raw = SMART_UNASSIGNED;
if (devinfo->smartignore[i] < 256)
devinfo->smart[devinfo->smartignore[i]].raw = SMART_UNASSIGNED;
for (i = 0; i < SMART_IGNORE_MAX; ++i) {
/* global ignore */
if (state->smartignore[i].attr_index > 0 && state->smartignore[i].attr_index < 256) {
devinfo->smart[state->smartignore[i].attr_index].raw = SMART_UNASSIGNED;
}
if (state->smartignore[i].attr_name[0] != 0) {
for (j = 0; j < SMART_COUNT; ++j) {
if (devinfo->smart[j].name[0] != 0
&& strcasecmp(devinfo->smart[j].name, state->smartignore[i].attr_name) == 0) {
devinfo->smart[j].raw = SMART_UNASSIGNED;
}
}
}
/* devinfo ignore */
if (devinfo->smartignore[i].attr_index > 0 && devinfo->smartignore[i].attr_index < 256) {
devinfo->smart[devinfo->smartignore[i].attr_index].raw = SMART_UNASSIGNED;
}
if (devinfo->smartignore[i].attr_name[0] != 0) {
for (j = 0; j < SMART_COUNT; ++j) {
if (devinfo->smart[j].name[0] != 0
&& strcasecmp(devinfo->smart[j].name, devinfo->smartignore[i].attr_name) == 0) {
devinfo->smart[j].raw = SMART_UNASSIGNED;
}
}
}
}
}