-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hddtemp: Support more than 32 drives #631
Conversation
Hi @tokkee! Your thoughts on this ? |
while ((name = strtok_r (ptr, "|", &saveptr)) != NULL && | ||
(model = strtok_r (NULL, "|", &saveptr)) != NULL && | ||
(temperature = strtok_r (NULL, "|", &saveptr)) != NULL && | ||
(mode = strtok_r (NULL, "|", &saveptr)) != NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're touching this anyway, it should use strsplit() from common.h instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strsplit() has a hard-coded set of field separators and won't split on |
.
The general approach sounds fine to me. I've added two comments on the code but otherwise didn't look at all details yet. |
Thanks for the patch @bgilbert. Could you please rebase on master so I can merge this? Thanks! |
Instead of building an array of fields and then walking it, split into fields as we go.
Dynamically scale the response buffer, up to a maximum of 1 MB.
Don't rely on signedness of buffer_size.
Done. |
Thank you so much @bgilbert! |
The hddtemp plugin imposes a 32-drive and 1024-byte limit on the response from the hddtemp daemon. On my system, the 1024-byte limit truncates the response after 29 drives.
Drop the drive limit and increase the buffer limit to 1 MB. (This is hopefully larger than anyone will need, and prevents collectd from being DoSed by the hddtemp daemon.)